NewsSimple整體架構(gòu)

DrawerLayout

使用側(cè)拉菜單作為導(dǎo)航DrawerLayout在android.support.v4.widget.DrawerLayout這個(gè)包里。這里抽屜我們用NavigationView。

布局

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout    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:id="@+id/drawer_layout"    
android:layout_width="match_parent"    
android:layout_height="match_parent"    
android:fitsSystemWindows="true"    
tools:context=".main.MainActivity">    
  
<android.support.design.widget.CoordinatorLayout        
android:id="@+id/main_content"        
android:layout_width="match_parent"        
android:layout_height="match_parent">        
<include            
android:id="@+id/appbar"            
layout="@layout/toolbar" />  
<!-- 主頁(yè)顯示的內(nèi)容 -->      
<FrameLayout            
android:id="@+id/frame_content"            
android:layout_width="match_parent"            
android:layout_height="match_parent"            
android:layout_below="@+id/appbar"            
android:elevation="5dp"            
android:scrollbars="none"            
app:layout_behavior="@string/appbar_scrolling_view_behavior" />    
</android.support.design.widget.CoordinatorLayout>    
<!-- 抽屜的內(nèi)容 -->
<android.support.design.widget.NavigationView        
android:id="@+id/navigation_view"        
android:layout_width="wrap_content"        
android:layout_height="match_parent"        
android:layout_gravity="start"        
app:headerLayout="@layout/navigation_header"        
app:menu="@menu/navigation_menu" />
</android.support.v4.widget.DrawerLayout>


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,939評(píng)論 25 709
  • afinalAfinal是一個(gè)android的ioc,orm框架 https://github.com/yangf...
    passiontim閱讀 15,857評(píng)論 2 45
  • 內(nèi)容抽屜菜單ListViewWebViewSwitchButton按鈕點(diǎn)贊按鈕進(jìn)度條TabLayout圖標(biāo)下拉刷新...
    皇小弟閱讀 47,146評(píng)論 22 665
  • 一開(kāi)始小北并不介意楊冰和他之間有一個(gè)女人和一個(gè)孩子的存在的。她甚至經(jīng)常向楊冰問(wèn)詢起那個(gè)叫香竹的女人。楊冰不愿多說(shuō),...
    一只失憶的貓_閱讀 368評(píng)論 0 0
  • 不知道從什么時(shí)候開(kāi)始 校園里的亭子,湖邊,座椅都印上了情侶的標(biāo)記。 當(dāng)自己一個(gè)人坐在圖書(shū)館旁邊的亭子時(shí),竟然擔(dān)心別...
    LAVIDA蠟筆塔閱讀 211評(píng)論 0 0

友情鏈接更多精彩內(nèi)容