美文网首页
抽屉式公告(SlidingDrawer)

抽屉式公告(SlidingDrawer)

作者: Yue_Q | 来源:发表于2018-10-10 19:02 被阅读0次

一. 实例说明

image.png

二. 关键技术

  主要利用 SlidingDrawer 控件与该控件的 orientation 属性,handle属性和content属性。

三. 代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context=".MainActivity">
    <!--设置抽屉控件-->
   <SlidingDrawer
       android:id="@+id/SlidingDrawer"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:layout_alignParentRight="true"
       android:layout_centerVertical="true"

       android:content="@id/myView"
       android:handle="@id/layout1"
       android:orientation="horizontal">
        <!--设置引导按钮-->
      <LinearLayout
          android:id="@+id/layout1"
          android:layout_width="35dp"
          android:layout_height="match_parent"
          android:orientation="horizontal">
         <ImageView
             android:id="@+id/Image"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:src="@mipmap/ic_launcher"/>
      </LinearLayout>

       <!--设置抽屉内容-->
      <ImageView
          android:id="@+id/myView"
          android:src="@mipmap/ic_launcher"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" />

   </SlidingDrawer>

</RelativeLayout>

https://github.com/Frioa/My200Application/tree/master/slidingdrawer

相关文章

网友评论

      本文标题:抽屉式公告(SlidingDrawer)

      本文链接:https://www.haomeiwen.com/subject/tpdmaftx.html