DrawerLayout
来源:互联网 发布:九维网络登录 编辑:程序博客网 时间:2024/05/01 00:21
activity_drawerlayout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".DrawerActivity" > <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- The main content view --> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/btn" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="open" /> </FrameLayout> <!-- The navigation drawer --> <ListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="#111" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" /> </android.support.v4.widget.DrawerLayout></RelativeLayout>
DrawerLayoutActivity.java
import android.os.Bundle;import android.app.Activity;import android.support.v4.widget.DrawerLayout;import android.view.Gravity;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class DrawerLayoutActivity extends Activity{ private DrawerLayout mDrawerLayout = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drawerlayout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); Button button = (Button) findViewById(R.id.btn); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // 按钮按下,将抽屉打开 mDrawerLayout.openDrawer(Gravity.LEFT); } }); }}
0 0
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- drawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- drawerLayout
- DrawerLayout
- DrawerLayout
- DrawerLayout
- 循环-07. 爬动的蠕虫(15)
- SwipeRefreshLayout
- wc
- oc中分类 扩展 协议的使用及区别
- 内核编译
- DrawerLayout
- UVa 331 交换的方案数 (回溯法,启发)
- C++ 多态、重载、函数隐藏
- spark SQL Running the Thrift JDBC/ODBC server
- 机器学习算法 - k-means Clustering K均值聚类
- MySQL服务无法启动(2003 - Can't connect to MySQL server on‘localhost' (10061).)
- killall
- red hat Linux操作系统下载地址
- Handler、MessageQueue 、Looper的关系