首先写一个ActivityBase类,里面封装了一些我们常用的方法,比如说打开Activity,Toast等等

protected void OpenActivity(Class<?> pClass) { Intent _intent = new Intent(); _intent.setClass(this, pClass); startActivity(_intent); } class做参数的时候形参是Class<?>mclass    这次我自己规定,形参一律使用_class的形式,成员变量使用mclass的形式。    由于我们要用到ToolBar所以要在Manifest中将style中的Theme改写为NoActionTheme`<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style></resources>````OK其他的暂时不变,<div class="se-preview-section-delimiter"></div>

这里写代码片
“`

这是在drawerlayout中的代码drawerlayout包括两部分

 <android.support.v4.widget.DrawerLayout        android:layout_height="match_parent"        android:layout_width="match_parent"        android:layout_below="@+id/toolbar"        android:fitsSystemWindows="true">        <include layout="@layout/drawercontent"></include>        <LinearLayout            android:layout_width="match_parent"            android:layout_height="match_parent"            android:background="@color/colorBlue"            android:layout_gravity="start|left"            android:layout_marginEnd="20dip"            android:layout_marginRight="20dip"            android:orientation="vertical"            android:paddingTop="48dp"            ></LinearLayout>    </android.support.v4.widget.DrawerLayout>

要注意一个问题,drawerlayout的定义中,长与宽不能写wrap_parent
这是在drawerlayout中的代码drawerlayout包括两部分,

更多相关文章

  1. Android中ViewPager and HorizontalScrollVIew 冲突
  2. 【Android(安卓)Studio】AS 使用记录06「常用快捷键」
  3. react-native之module的使用
  4. Android中visibility属性
  5. V4包下Fragment替换为源码下Fragment的心路历程
  6. 基于unity3d游戏的android版本逆向初探
  7. SurfaceFlinger启动过程分析(一)、(二)、(三)、(四)【转】
  8. Ubuntu 18.04 环境下编译Android(安卓)源码
  9. AndroidStudio使用Git发布与更新,同步,关联github

随机推荐

  1. 「Android(安卓)进阶」Android(安卓)项目
  2. android G1蓝牙与无线网络,APN接入点设置
  3. Android消息机制Handler的工作过程详解
  4. basic4android 开发教程翻译(二)可视化设
  5. No 99 · 【android】apk在线升级
  6. Android屏幕的大小、密度以及字符缩放比
  7. Android(安卓)禁止系统休眠,使屏幕不变暗
  8. android videoView 按不同比例缩放
  9. android style的继承方式 点(.)和parent
  10. Android(安卓)Fresco图片处理库用法API英