安卓开发笔记(一) Slidingdrawer

利用sliderdrawer实现上拉显示隐藏内容

实例代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:gravity="bottom"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="false"
>
 
    <SlidingDrawer
        android:handle="@+id/slide_button"
        android:orientation="vertical"
        android:content="@+id/content"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:id="@+id/drawer"
    >
<LinearLayout
        android:id="@id/slide_button"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="vertical"
    >
        <TextView
            android:id="@+id/grade_information"
            android:textColor="@color/text_color"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:gravity="center"
            android:text="@string/grade_text"
            android:background="@color/item_color"
            android:textSize="12dp"
             />
        <TextView
            android:id="@+id/item_information"
            android:textColor="@color/text_color"
            android:layout_width="fill_parent"
            android:layout_height="35dp"
            android:gravity="center_horizontal"
            android:text="@string/data_text"
            android:background="@color/item_color"
            android:textSize="8dp"
            />
    </LinearLayout> 

  <LinearLayout android:id="@id/content"
   android:layout_width="fill_parent" android:layout_height="fill_parent"
   android:background="#ffffff">

   <TextView android:text="这是一个滑动式抽屉的示例"
   android:id="@+id/tv"
   android:textSize="18px"
   android:textColor="#000000"
   android:gravity="center_vertical|center_horizontal"
   android:layout_width="match_parent"
   android:textStyle="bold"
   android:layout_height="match_parent"></TextView>
  </LinearLayout>

 </SlidingDrawer>
</LinearLayout>



你可能感兴趣的:(安卓开发笔记(一) Slidingdrawer)