目录

ps:如果你觉得对你有帮助的话,麻烦点个赞加个关注

  • 效果图:

  • 代码:

效果图:


代码:

res/layout/activity_main.xml
<?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"    android:background="@drawable/bg"    tools:context=".MainActivity">    <!--设置抽屉控件-->    <SlidingDrawer        android:id="@+id/drawer1"    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:gravity="center">    <ImageView        android:id="@+id/myImage1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:src="@drawable/open" />    </LinearLayout>    <!--设置抽屉内容-->    <ImageView    android:id="@+id/myView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:src="@drawable/iv_bg" />    </SlidingDrawer></RelativeLayout>

res/values/strings.xml

<resources>    <string name="app_name">公告</string></resources>

res/values/styles.xml

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">    </style></resources>
package com.example.announcementdrawer;import android.app.Activity;import android.os.Bundle;import android.widget.ImageView;import android.widget.PopupWindow;import android.widget.SlidingDrawer;public class MainActivity extends Activity {         @Override    protected void onCreate(Bundle savedInstanceState) {             super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);    }}

更多相关文章

  1. Android上发送带附件的邮件
  2. Android给View画边框
  3. 介绍一个Android开源项目:GifView——Android显示GIF动画
  4. Android下使用Properties文件保存程序设置
  5. android 设置系统屏幕亮度
  6. 设置 Toolbar(ActionBar) 上的按钮颜色
  7. Android——Android(安卓)Studio开发环境搭建及设置本地Gradle方
  8. Android的断点设置
  9. 在RelativeLayout布局中可以设置标签的android:layout_toLeftO..

随机推荐

  1. Android 示例之 notepad
  2. Android中获得SD卡中的值
  3. FregServer进程,封装进程间通信数据
  4. delphi android 中 Toast 的实现(老外写
  5. Android-AlarmManager(全局定时器/闹钟)
  6. 关于android linux kernel
  7. android studio更新提示网络连接失败的解
  8. ToolBar的使用
  9. android 自定义控件之折线图自己写代码,不
  10. android webview 使用