0

Can i Convert this Linear Layout view into Relative Layout view with proper weight.

<?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>

enter image description here

this is the o/p which i am getting from the above linear layout i want the same using relative layout that support all the devices.

4

1 回答 1

0

我认为在相对布局中你不能使用重量,但你可以实现这个设计,你可以让你的问题清楚。您在设计此布局时发现什么困难?如果您选择不同的屏幕尺寸,相对布局会更好

于 2013-01-26T14:48:23.693 回答