Reputation: 20569
I'm trying create one Framelayout that contains a child Framelayout, I'm not able to position the child Framelayout to the right side of the parent Framelayout!.
I tried with android:foregroundGravity="right"
and android:layout_weight="1"
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1">
<com.example.ListViewActivity
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</com.example.ListViewActivity>
<FrameLayout
android:id="@+id/indexRight"
android:layout_width="36dp"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:background="@color/white"
android:orientation="vertical" >
</FrameLayout>
</FrameLayout>
Screen Shot:
As mentioned in the above image I want to move the white FrameLayout into right.
Thanks
Upvotes: 3
Views: 5362
Reputation: 7979
From the Android Documentation on FrameLayout
FrameLayout is designed to block out an area on the screen to display a single item
You should use a LinearLayout
or a RelativeLayout
as root, unless you want to display only one child at any given time. I assume that com.example.ListViewActivity
is a custom View you have implemented, and NOT an actual Activity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<com.example.ListViewActivity
android:id="@+id/list_view"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1">
</com.example.ListViewActivity>
<!-- This FrameLayout will be located on the right side, with the ListView on its left side -->
<FrameLayout
android:id="@+id/indexRight"
android:layout_width="36dp"
android:layout_height="fill_parent"
android:background="@color/white">
<!-- SINGLE child here -->
</FrameLayout>
</LinearLayout>
Upvotes: 1