这是我正在使用的代码,它不工作:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView android:text="TextView" android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
</TextView>
</LinearLayout>
发布于 2013-02-04 06:08:16
尝试在您想要正确看到的元素之前的水平LinearLayout
中添加空的View
,例如:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
发布于 2015-03-23 16:45:31
设置视图的layout_weight="1"
就可以了。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
发布于 2011-08-09 15:40:28
将android:gravity="right"
添加到LinearLayout。假设TextView
具有layout_width="wrap_content"
https://stackoverflow.com/questions/6992804
复制相似问题