Relative Layout Issue For Xoom Tablet
I am having issues with layout for Xoom Tablet. Basically, I want one fragment (ListView) on the left side and the other fragment right to the ListView Fragment. But, I am having two issues on this.
Firstly, I dont want to hard code the android:layout_width for the listview fragment which is set to 200dip (Refer code below). I tried wrap_content, fill_parent but it didnt work for me.
Secondly, this UI is not rendered on the whole screen. Its only capturing a small portion of the whole tablet screen. Even hard coding from fill_parent to other values din't have开发者_如何学JAVA any effect.
The code is as shown below. I would really appreciate any sort of help on this problem.
~Thank you !!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment class="com.example.android.apis.app.FragmentLayout$TitlesFragment"
android:id="@+id/titles" android:layout_width="200dip"
android:layout_alignParentLeft="true"
android:layout_height="match_parent" />
<FrameLayout android:id="@+id/details"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/titles"
android:background="?android:attr/detailsElementBackground" />
</RelativeLayout>
instead of hardcoding you can set the layout weight of each framelayout. ie
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/items_layout"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent"
android:background="?android:attr/detailsElementBackground" />
<FrameLayout
android:id="@+id/details_layout"
android:layout_weight="2"
android:layout_width="0px"
android:layout_height="match_parent"
android:background="?android:attr/detailsElementBackground" />
Not sure why your UI isn't taking up the entire screen. Are you supporting largeScreens, there is a setting in the manifest.
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true">
</supports-screens>
精彩评论