【发布时间】:2013-06-21 19:36:53
【问题描述】:
我正在开发一个包含一些文本视图和按钮的 Android 应用程序。
我需要将 Button 放在文本视图之后。当我的 TextView 是运行良好的单行时。但是当使用多行文本视图时,我的按钮被放置在第 1 行的末尾。
如何将按钮放置在正确的位置(在文本视图的最后一行之后)?
编辑后:
这是我的 xml,我在我的代码中使用它并动态生成它。
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:shrinkColumns="1"
android:stretchColumns="1" >
<TableRow android:id="@+id/tableRow1" >
<Button
android:id="@+id/ayehPlace_btnCounter"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ayeh_counter"
android:text="" />
<TextView
android:id="@+id/ayehPlace_txtAyeh"
android:layout_width="wrap_content"
style="@style/ayehPlace_txt"
android:layout_height="wrap_content"
android:text="" />
</TableRow>
</TableLayout>
【问题讨论】:
-
尝试使用 android:baselineAligned=""
-
输入您的布局代码或显示一些粗略的草图。
-
听起来你在(大概)水平的
LinearLayout上寻找android:gravity="bottom"。 -
你想要你的
Button就在TextView的正下方吗? -
不,我希望它放在我的 textview 的结尾字符旁边
标签: android eclipse android-layout textview android-button