vendredi 31 juillet 2015

Text view is not adjusting according to weights in linear layout

This is my xml file to design a layout. I am using liner layout with weights to set the layout. but text view with id data_message and its follower layout is not taking weight according to given. all other layout before it working proper. I can't understand this error. please help to find out this.

<ScrollView xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#ffffff"
>
 <LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:weightSum="100"
android:orientation="vertical"
>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="10"
    android:background="@color/primary_dark_material_dark"
    android:orientation="horizontal"
    android:weightSum="10">
    <ImageView

        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="3"
        android:src="@drawable/logoback"
        android:padding="2dp"
        android:clickable="true"
        android:id="@+id/home_img"
        />
    <TextView
        android:id="@+id/userbox"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="4.5"
        android:textColor="#ffffff">

    </TextView>
    <Spinner
        android:id="@+id/optionmenu"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="2.5"
        android:prompt="@string/profile"
        android:tag="Menu"
        android:background="#ffffff"
        ></Spinner>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="90"
    android:background="#ffffff"
    android:layout_margin="10dp"
    android:padding="10dp"
    android:orientation="vertical"
    android:weightSum="100"
    >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">
        <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/name"
            />
        <TextView
            android:id="@+id/data_name"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
        </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">

    <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/company_name"
            />
        <TextView
            android:id="@+id/data_company"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/saddress"
            />
        <TextView
            android:id="@+id/data_address"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/phone"
            />
        <TextView
            android:id="@+id/data_phnNo"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/subject"
            />
        <TextView
            android:id="@+id/data_sub"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="2"
        android:layout_margin="2dp">

        <TextView
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:text="@string/city"
            />
        <TextView
            android:id="@+id/data_city"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>
    </LinearLayout>
    <TextView
        android:id="@+id/data_message"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        android:minHeight="50dp"
        android:hint="Message"
        android:background="#ffffff"
        android:padding="2dp"
        android:layout_marginBottom="5dp"
        android:textColor="@color/primary_dark_material_dark"/>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:orientation="horizontal"
    android:weightSum="3">
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:weightSum="3">
    </LinearLayout>
    <Button
        android:id="@+id/canrplybtn"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="fill_parent"
        android:text="@string/rply"
        android:visibility="invisible"
        android:background="@color/primary_dark_material_dark"
        android:textColor="@color/abc_primary_text_material_dark"/>
</LinearLayout>
    <LinearLayout
        android:id="@+id/form"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="40"
        android:orientation="vertical"
        android:layout_marginLeft="2dp"
        android:layout_marginRight="20dp"
        >
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            />
    </LinearLayout>
</LinearLayout>

Aucun commentaire:

Enregistrer un commentaire