亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

使用DrawerLayout組件實(shí)現(xiàn)側(cè)滑抽屜的功能

 更新時(shí)間:2016年08月23日 09:48:13   投稿:mrr  
DrawerLayout組件同樣是V4包中的組件,也是直接繼承于ViewGroup類,所以說是一個(gè)容器類,下面通過本文給大家介紹使用DrawerLayout組件實(shí)現(xiàn)側(cè)滑抽屜的功能,感興趣的朋友一起看下吧

DrawerLayout組件同樣是V4包中的組件,也是直接繼承于ViewGroup類,所以這個(gè)類也是一個(gè)容器類。使用DrawerLayout可以輕松的實(shí)現(xiàn)抽屜效果,使用DrawerLayout的步驟有以下幾點(diǎn):

1)在DrawerLayout中,第一個(gè)子View必須是顯示內(nèi)容的view,并且設(shè)置它的layout_width和layout_height屬性是match_parent.

2)第二個(gè)view是抽屜view,并且設(shè)置屬性layout_gravity="left|right",表示是從左邊滑出還是右邊滑出。設(shè)置它的layout_height="match_parent"

例子:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="content" />
<ListView
android:id="@+id/listview"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#FFB5C5" />
</android.support.v4.widget.DrawerLayout>

實(shí)現(xiàn)的效果:

以上所述是小編給大家介紹的使用DrawerLayout組件實(shí)現(xiàn)側(cè)滑抽屜的功能,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論