<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:content="@+id/content"
android:handle="@+id/handle" >
<RelativeLayout
android:id="@+id/handle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFFFFF"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true" >
<ImageView
android:id="@+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="gotoArrowTopBottom"
android:padding="10dp"
android:background="@drawable/red"/>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" >
<ImageView
android:id="@+id/listid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="gotoListView"
android:padding="10dp"
android:src="@drawable/list" />
<ImageView
android:id="@+id/supportid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="gotoTextView"
android:padding="10dp"
android:src="@drawable/supportimage" />
<ImageView
android:id="@+id/lockid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/lockicon" />
<ImageView
android:id="@+id/favouriteid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/favourite" />
<ImageView
android:id="@+id/mapid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/map" />
<ImageView
android:id="@+id/contactinfoid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/contactinfo" />
<ImageView
android:id="@+id/noteid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/note" />
<ImageView
android:id="@+id/remainderid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/reminder" />
<ImageView
android:id="@+id/recordid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/recording" />
<ImageView
android:id="@+id/emailid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/email" />
<ImageView
android:id="@+id/settingsid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/settings" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#FFF000" >
<EditText
android:id="@+id/supportTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="enter"
android:visibility="gone" />
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
</ListView>
</LinearLayout>
</SlidingDrawer>
public class SlidingDrawerBottom extends Activity {
protected ListView mList;
protected SlidingDrawer mSlider;
protected TextView mTextView;
protected ImageView mArrowImage;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextView = (EditText) findViewById(R.id.supportTextView);
mArrowImage=(ImageView)findViewById(R.id.arrow);
mList = (ListView) findViewById(R.id.listView1);
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
SlidingDrawerBottom.this, R.layout.slider_row);
arrayAdapter.add("vvvvvvvvvv");
arrayAdapter.add("xxxxxxxxxx");
arrayAdapter.add("yyyyyyyyyy");
arrayAdapter.add("iiiiiiiiii");
mList.setAdapter(arrayAdapter);
mList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Toast.makeText(SlidingDrawerBottom.this,
"Row " + arg2 + "clicked", Toast.LENGTH_LONG).show();
}
});
mSlider = (SlidingDrawer) findViewById(R.id.slidingDrawer1);
mSlider.lock();
mSlider.setOnDrawerOpenListener(new OnDrawerOpenListener() {
public void onDrawerOpened() {
mSlider.lock();
mArrowImage.setBackgroundResource(R.drawable.red);
Toast.makeText(getApplicationContext(), // <- Line changed
"opened", Toast.LENGTH_LONG).show();
}
});
mSlider.setOnDrawerCloseListener(new OnDrawerCloseListener() {
public void onDrawerClosed() {
mArrowImage.setBackgroundResource(R.drawable.red_down);
}
});
}
public void gotoListView(View V) {
mList.setVisibility(View.VISIBLE);
mTextView.setVisibility(View.GONE);
if (!mSlider.isOpened()) {
// if the mSlider is not open then open it and display
mSlider.animateOpen();
}
}
public void gotoTextView(View v) {
mTextView.setVisibility(View.VISIBLE);
mList.setVisibility(View.GONE);
if (!mSlider.isOpened()) {
mSlider.animateOpen();
}
}
public void gotoArrowTopBottom(View v) {
// only mapview should be displayed all the views should be hidden
mSlider.animateClose();
mTextView.setVisibility(View.GONE);
mList.setVisibility(View.GONE);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//menu code
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}