影子论坛

发新帖

制作一个简单的滑动布局 教程

风的影子 2018-2-24 868

新版的手机C支持直接按类名加载xml控件,手机C本身包含SlidingPaneLayout(滑动菜单),所以可以利用这个功能实现滑动布局

使用方法:

在工程assets目录建议一个xml文件,比如SlidingPaneLayout.xml,打开xml,输入以下内容:

<android.support.v4.widget.SlidingPaneLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<LinearLayout

android:layout_width="130dp"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="文本"
android:textSize="16"
></Button>

</LinearLayout>
<LinearLayout

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="向左滑显示文本"
android:textSize="16"
></Button>



</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>

一个简单的滑动菜单就完成了

最新回复 (0)
返回
发新帖
风的影子
主题数
83
帖子数
49
注册排名
1

Processed Time:0.20364499092102