android - How to set the percentage in screen of each fragment -


i want design divided screen 2 non equal parts in landscape mode of screen. so, thought automatically in using fragments. problem have encountered each fragment match half of screen. , that's not want exactly. want screen 2 parts non equal in width. want this:

enter image description here

you can make use of weight parameter.

<linearlayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="horizontal" >      <linearlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="1" />      <linearlayout         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="3" /> </linearlayout> 

please notice weights used 2 linearlayouts. first 1 has weight of 1 (it can occupy 1/4 th of screen) , second 1 3 (it can occupy 3/4 th of screen).

just use exact same concept fragments , maintain nay proportion wish.

hope make myself clear.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -