• 015、SlidingDrawer 隐藏式抽屉


    SlidingDrawer控件,实现抽屉效果。
    SlidingDrawer配置采用了水平展开或垂直展开两种(android:orientation)方式,在XML里必须指定其使用的android:handle与android:content,前者委托要展开的图片(Layout配置,即把手),后者为委托要展开的LayoutContent。
        <SlidingDrawer
            android:id="@+id/sd"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/tv"
            android:content="@+id/sd_content"
            android:handle="@+id/sd_handle"
            android:orientation="horizontal" >
            <ImageView
                android:id="@id/sd_handle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/open" />
            <GridView
                android:id="@id/sd_content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:numColumns="2" >
            </GridView>
        </SlidingDrawer>

     

    在代码中,通过该控件的setOnDrawerOpenListener()与setOnDrawerCloseListener()方法监控抽屉的打开和关闭

            sd.setOnDrawerOpenListener(new OnDrawerOpenListener() {
                @Override
                public void onDrawerOpened() {
                    // TODO Auto-generated method stub
                    sd_handle.setImageResource(R.drawable.close);
                    tv.setText(getString(R.string.tv_close));
                }
            });
            sd.setOnDrawerCloseListener(new OnDrawerCloseListener() {
                @Override
                public void onDrawerClosed() {
                    // TODO Auto-generated method stub
                    sd_handle.setImageResource(R.drawable.open);
                    tv.setText(getString(R.string.tv_open));
                }
            });
  • 相关阅读:
    格式刷的一小步,原型工具的一大步
    精益设计,敏捷开发,一个都不能少
    慢工出细活,Facebook点赞按钮设计中的门道
    5个范例告诉你什么是自适应网页设计
    用户体验设计5大目标
    poj1251Jungle Roads(最小生成树)
    hdu2222Keywords Search
    hdu2328Corporate Identity
    hdu1238Substrings
    hdu4763Theme Section
  • 原文地址:https://www.cnblogs.com/zyh-blog/p/3343632.html
Copyright © 2020-2023  润新知