I have multiple activities in my app and i want a slidingdrawer to appear in all the activities. I am following the approach given here.
The app starts with a black screen with the slidingdrawer handle.
Issue is that the sliding drawer is visible but the activity layout put in FarmeLayout is not visible.
The activity is there for sure. Toasts came up when the first activity loaded. So I modified my first activity to have only a button on it to go to next activity.
Next I used the direction keys on the AVD, and pressed ok which brought up the the next activity's Toast. Second activity is as well hidden.
So what am I missing???
My Sliding Drawer layout xml (LinearLayout) with farme layout at the end:
<LinearLayout 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:orientation="horizontal"
android:gravity="center_vertical">
<SlidingDrawer
android:id="@+id/slidingDrawer"
android:handle="@+id/drawerHandle"
android:content="@+id/contentLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:persistentDrawingCache="all">
<ToggleButton
android:id="@+id/drawerHandle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="5dp"
android:textSize="14dp"
android:textStyle="italic"
android:background="#BB00FF"
android:rotation="270"
android:textOn=""
android:textOff=""/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contentLayout"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/todo">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/list_view_" />
</LinearLayout>
</SlidingDrawer>
<FrameLayout
android:id="@+id/act_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#808080"
android:visibility="visible">
</FrameLayout>
</LinearLayout>
DrawerActivity java code:
public abstract class DrawerActivity extends Activity
{
protected LinearLayout fullLayout;
protected FrameLayout actContent;
@Override
public void setContentView(final int layoutResID)
{
fullLayout= (LinearLayout) getLayoutInflater().inflate(R.layout.act_layout, null); // Your base layout here
actContent= (FrameLayout) fullLayout.findViewById(R.id.act_content);
getLayoutInflater().inflate(layoutResID, actContent, true); // Setting the content of layout your provided to the act_content frame
super.setContentView(fullLayout);
}
}
In all my activitie files I have put setContentView(R.layout.XXXXXXXX);
in the onCreate method.
So how do I make the activities visible?? What am I doing wrong??
I tried putting in the following but to no effect
actContent.setVisibility(layoutResID);
or
actContent.setVisibility(View.VISIBLE);