SlidingDrawer類雖然已經不推薦使用了,但有時如果效果簡單的話用用也無妨,反正我有有點懷念,主要是它使用簡單,只能上下或者左右滑動,而且剛開始的時候,方向不能指定,
布局檔案
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000099">
<SlidingDrawer
android:id="@+id/slidingdrawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:content="@+id/content"
android:handle="@+id/handle"
android:orientation="vertical" >
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/lo19" >
</ImageView>
<LinearLayout
android:id="@id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#008800">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="隱藏的內容"/>
</LinearLayout>
</SlidingDrawer>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="bottom textView"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical|center_horizontal"/>
</LinearLayout>
在主介面中不寫什麼代碼就可以滑了,
如果要寫一些方法,主要是下面幾個方法
SlidingDrawer sd = (SlidingDrawer)findViewById(R.id.slidingdrawer);
sd.setOnDrawerOpenListener(new OnDrawerOpenListener(){
public void onDrawerOpened() {
// TODO Auto-generated method stub
}
});
sd.setOnDrawerCloseListener(new OnDrawerCloseListener(){
public void onDrawerClosed() {
// TODO Auto-generated method stub
}
});
sd.setOnDrawerScrollListener(new OnDrawerScrollListener(){
public void onScrollEnded() {
// TODO Auto-generated method stub
}
public void onScrollStarted() {
// TODO Auto-generated method stub
}
});
下面這抽屜把手機上的應用程式的表徵圖在抽屜中以縮小的表徵圖來顯示,這是