Reputation: 175
For the xml line:
android:layout_width="fill_parent"
, is there a const value like fill_parent/2? I want my object to fill only half of the screen and not all of it.
Upvotes: 0
Views: 631
Reputation: 5227
You can use "weight" of the linear layout for this purpose. e.g. if you want to divide available space between two control:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1.0"/>
<EditText
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1.0"/>
</LinearLayout>
Upvotes: 2
Reputation: 8242
for proportionate dimension use Layout_weight
method for LinearLayout .
for your case
<Linearlayout weight_sum=2>
<yourView layout_weight=1 />
</Linearlayout>
//sudo syntax
Upvotes: 1