android layout - Activity with two fragments showing different on screen rotation -
i have 1 activity fragments. don't know how make layout 1 under in portrait orientation, , 1 next other in landscape orientation. have make 2 layouts , check orientation in "oncreate" method , render appropriate one? or should set layout differently? (as now, ok in portrait view, in landscape view overlap).
here layout:
<relativelayout 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:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.apps.rucsi.biorhytm.mainactivity"> <fragment android:name="com.apps.rucsi.biorhytm.inputfragment" android:id="@+id/inputfragment" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true"/> <fragment android:name="com.apps.rucsi.biorhytm.outputfragment" android:id="@+id/outputfragment" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true"/>
so happening here set top fragment align top of parent android:layout_alignparenttop="true"
, bottom fragment align bottom of parent android:layout_alignparentbottom="true"
. lucky on portrait fit.
you can few things set add second fragment tell bellow first fragment android:layout_toendof="@+id/inputfragment"
.
or put them linear layout.
Comments
Post a Comment