The New York Times app seems to have a SlideDrawer that pulls down over a ListAdapter. This is the effect I am trying to accomplish. I have a custom listadapter that works fine on its own, and I have a slidedrawer that works fine, on its own. They are two separate Activities. I want to merge the two so that there is a slidedraw over the listadapter.
I have tried SetContentView on the ListActivity that implements my ArrayAdapter to the xml file that houses the slide drawer, but i get a forceclose. I think its because a listadapter is essentially a bunch of tiny inflated views of the same xml layout, and I’m trying to run two layouts at the same time. I’ve thought maybe the answer lies in how the xml file is laid out but honestly have no idea.
anyways here’s the code:
import android.view.View;
import android.net.Uri;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.SlidingDrawer;
import android.widget.AdapterView.OnItemClickListener;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
public class BandApp extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//here is where I have tried setting slidedrawer layout
setContentView(R.layout.slidedrawer)
Activity activity = this;
activity.setTitle("@$@#$$@$#$");
final String[] values = {"Litem0","Litem1","Litem2","Litem3","Litem4","Litem5"};
MyAdapter Adapter = new MyAdapter(this, values);
setListAdapter(Adapter);
and for the xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="85dp"
>
<TextView
android:layout_height="0dp"
android:layout_width="0dp"
android:id="@+id/textlayout"
/>
</LinearLayout>
Like I said, they both work fine on there own but I’m wondering how to merge the two and gain the effect found on the New York Times app. Thank you.
Here is an image of what i’m talking about. The “dine and wine” at the top pulls down, so I’m guessing its a slidedrawer?:

A Sliding drawer may only come from the bottom, or the right. It cannot come from the top. You could check out this question for some possible solutions.
However the code you have won’t even get you a normal sliding drawer. What you need is both a ListView and a SlidingDrawer (with handle, etc) in your XML, and all of that should be in a layout that allows things to overlap, like RelativeLayout. Then in your activity, you will set that as the content view.
There is a recipe here, that will get a ListView to be above a SlidingDrawer, which can sometimes be tricky