I need help you .I dont know why this code dont run correctly.I want first textview and edittext have 50% space and second textview and edittext have 50% other while it only display a empty layout.
please help me thanks
<RelativeLayoutandroid:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="1.0"
>
<TextView
android:layout_height="wrap_content"
android:layout_weight="0.10"
android:layout_width="0dip"
android:id="@+id/lytner_card_question_text"
android:layout_alignParentRight="true"
android:gravity="center"
android:textSize="20dp"
/>
<ScrollView android:id="@+id/myparentScrollview"
android:layout_height="100dp"
android:layout_weight="0.40"
android:layout_width="0dip"
android:layout_toLeftOf="@+id/lytner_card_question_text"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lytner_card_question_etext"
android:minHeight="100dp"
/>
</ScrollView>
<TextView
android:layout_height="wrap_content"
android:layout_weight="0.10"
android:layout_width="0dip"
android:id="@+id/lytner_card_answer_text"
android:layout_toLeftOf="@+id/myparentScrollview"
android:gravity="center"
android:textSize="20dp"
/>
<ScrollView android:id="@+id/myparentScrollview1"
android:layout_height="100dp"
android:layout_weight="0.40"
android:layout_width="0dip"
android:layout_toLeftOf="@+id/lytner_card_answer_text"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lytner_card_answer_etext"
android:minHeight="100dp"
/>
</ScrollView>
</RelativeLayout>
There is no point in adding weight sum to a Relative Layout. It only works for Linear Layout. Change your Relative Layout to a Linear Layout and then try again.
The following code gives you two LinearLayouts as containers, each with height half of the screen:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/container1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></LinearLayout>
<LinearLayout
android:id="@+id/container2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
</LinearLayout>
In Relative layout weight does not work , change your layout to linear then try weight.