different design for portrait and landscape mode in android -
hi have created 2 fragments on single layout.
in layout-land :
fragments need display horizontally.
in layout-port : fragments need display vertically.
now have run app on portrait mode means displaying fragment vertically. have rotate these landscape mode means displaying fragments vertically only.
at same time have run app on landscape mode means displaying fragment horizontally.now have rotate these portrait mode means displaying fragment horizontally.
but wish display output like:
i have run app on portrait mode means displaying fragment vertically. have rotate these landscape mode means displaying fragments horizontally.
at same time have run app on landscape mode means displaying fragment horizontally.now have rotate these portrait mode means displaying fragment vertically.
how can ???
why getting result above.please give me suggestions .
edit:
layout-land : fragment.xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/_listdetails" > <imageview android:id="@+id/refresh" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_gravity="center_vertical" android:layout_toleftof="@+id/pos" android:src="@drawable/ref_off" /> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/layout" android:background="#414042" android:orientation="horizontal" > <fragment android:id="@+id/activity_main" android:name="com.notch.notchbolly.mainactivity" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="0.83" /> <view android:layout_width="2dp" android:layout_height="fill_parent" android:background="#ffffff" /> <fragment android:id="@+id/subcate" android:name="com.notch.notchbolly.subcate" android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="1" /> </linearlayout> </relativelayout>
layout-port: fragment.xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/_listdetails" > <imageview android:id="@+id/refresh" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_gravity="center_vertical" android:layout_toleftof="@+id/pos" android:src="@drawable/ref_off" /> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/layout" android:background="#414042" android:id="@+id/orien" android:orientation="vertical" > <fragment android:id="@+id/activity_main" android:name="com.notch.notchbolly.mainactivity" android:layout_width="fill_parent" android:layout_height="200dp" /> <view android:layout_width="fill_parent" android:layout_height="3dp" android:background="#ff0000" /> <fragment android:id="@+id/subcate" android:name="com.notch.notchbolly.subcate" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout> </relativelayout>
this androidlistfragmentactivity:
public class androidlistfragmentactivity extends fragmentactivity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.fragment); imageview refresh = (imageview) findviewbyid(r.id.refresh); refresh.setonclicklistener(new onclicklistener() { public void onclick(view v) { intent in = new intent(androidlistfragmentactivity.this, androidlistfragmentactivity.class); startactivity(in); } }); } @override public void onconfigurationchanged ( configuration newconfig ) { super.onconfigurationchanged(newconfig); } }
remove android:configchanges="orientation"
activity declaration in manifest file.
Comments
Post a Comment