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"/> 

the result in portrait:enter image description here

and in lanscape overlap :enter image description here

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -