English 中文(简体)
2. 在布局的底部建立 but——2.2
原标题:Set the button at the very bottom of the layout - Android 2.2

I have a table layout in which i have declared a button statically in the XML file. I add rows dynamically in the program. I want the button to be set at the very end of the table layout. I tried doing that using android:layout_gravity="bottom" but that is not helping.

任何解决办法?

这是我的XML。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbars="horizontal|vertical"
android:scrollbarStyle="outsideInset" >
<TableLayout 
    android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content">
    <Button 
        android:id="@+id/back"
        android:layout_gravity="bottom"
    />
</TableLayout>
</ScrollView>
最佳回答

我并不确切地知道它将为你工作,但你可以做的是,通过删除掉子,然后在增加你的所有内容之后的一段时期内添加。

例:

    TableLayout tv = (TableLayout ) findViewbyId(R.id.table_layout_id);
    Button button = (Button) findviewbytid(R.id.button_id);

愿你们需要布局,以便你能够轻易获得。

    LayoutParams lp = button.getLayoutParams();

你们的纽子离开了布局。

    tv.removeView(button);

ADD ALL YOUR VIEW AT RUNTIME。

页: 1

     tv.addView(button, lp);

我尝试了这一法典,但我认为它应当发挥作用。 在某些情况下,你不需要布局,这样你也可以忽视。

问题回答

我不相信有办法将儿童重新归类为,而没有将所有儿童驱逐出去,并按适当的顺序重新登记。 如果<代码>ListView将足以代替<代码>TableLayout,则该编码有addFooterView()方法,可实现你之后的重述。

put button outside the table and scroll-view...... i mean below the scroll-view





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签