我想在 textview 右侧添加一个按钮,如果 textview 增长,按钮仍然存在。我使用 FrameLayout 或 RelativeLayout 但它们不起作用,请帮助我。像这张图片的布局http://www.8pic.ir/images/97364937705465965477.png
问问题
706 次
2 回答
0
尝试使用LinearLayout
as 。orientation
horizontal
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="your text"
/>
<Button
android:id="@+id/button_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="button" />
</LinearLayout>
于 2013-10-01T19:00:24.663 回答
0
这是不可能的,而且对于 Android 开发也不是好的做法。虽然如果这是您的要求,那么您可以在运行时计算最后一行中的行数和字符数,并通过使用框架或相对布局来确定按钮的位置。
于 2013-10-02T07:54:55.297 回答