我可以将此线性布局视图转换为具有适当重量的相对布局视图。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.2"
android:weightSum="3" >
<Button
android:id="@+id/favButton2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.2" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".6"
android:weightSum="2" >
<EditText
android:id="@+id/searchText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".6" />
<Button
android:id="@+id/gotoButton"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.4" />
</LinearLayout>
<Button
android:id="@+id/favButton4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.2" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.2"
android:background="@drawable/appback" >
<TextView
android:id="@+id/category"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:textColor="#000" />
</LinearLayout>
<ScrollView
android:id="@+id/scrollBackground"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".4"
android:background="@drawable/appback" >
<TextView
android:id="@+id/favSms"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.2"
android:weightSum="2" >
<Button
android:id="@+id/nextFavSms"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Next" />
<Button
android:id="@+id/PreFavSms"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Pre" />
</LinearLayout>
这是我从上面的线性布局得到的o / p我希望使用支持所有设备的相对布局相同。
答案 0 :(得分:0)
我认为在相对布局中你不能使用重量,但你可以实现这个设计,你可以让你的问题清楚。您在设计此布局时遇到了什么困难?如果你选择不同的屏幕尺寸,相对布局会更好