SliderDraw 简单使用

    技术2022-05-13  50

    SliderDraw 的关键是理解3点:

    1:handle: 点击的按钮

    2:content:展开的内容

    3:SliderDraw不是一个独立控件,而只能作为2级控件来使用,即它外面必须再包一个view(layout)来控制大小,而它本身必须是充满这个父view的。

     

    主要工作在XML里面:

    <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     > <ImageView      android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:src = "@drawable/backup"     />              <RelativeLayout      android:layout_alignParentRight = "true"         android:layout_width="100dp"     android:layout_height="fill_parent"     >   <SlidingDrawer    android:id="@+id/drawer1"        android:layout_width = "wrap_content"    android:layout_height = "fill_parent"    android:handle = "@+id/myimage1"    android:content = "@+id/content1"     android:orientation="horizontal"    >  <ImageView     android:id="@id/myimage1"     android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:src = "@drawable/open"       />         <GridView      android:id="@id/content1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:numColumns="1"     android:background = "#80808080"    />        </SlidingDrawer> </RelativeLayout>        </RelativeLayout>


    最新回复(0)