效果:
---->点击图标-->
实现:只要用SlidingDrawer控件就可以做出点击图标,显示或隐藏内容,不需要再MainActivity上写任何代码,可以参考官网文档https://developer.android.google.cn/reference/android/widget/SlidingDrawer做更多的事
main.xml:
<SlidingDrawer android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:handle="@+id/handle" android:content="@+id/content"> <ImageView android:id="@id/handle" android:layout_width="88dip" android:layout_height="44dip" /> <GridView android:id="@id/content" android:layout_width="match_parent" android:layout_height="match_parent" /> </SlidingDrawer>