material design風格的導航抽屜Activity:MaterialNavigationDrawer

擁有material design風格和簡單方法的導航抽屜Activity。

It requires 11+ API and android support v7 (Toolbar)

Download example apk

How to add to your project

In your Activity...

public class MyActivity extends MaterialNavigationDrawer {

    @Override
    public void init(Bundle savedInstanceState) {
        // set cover background
        this.setDrawerBackground(this.getResources().getDrawable(R.drawable.mat1));
        // set user photo and data
        this.setUserPhoto(this.getResources().getDrawable(R.drawable.photo));
        this.setUsername("NeoKree");
        this.setUserEmail("neokree@gmail.com");

        // add your sections
        this.addSection(this.newSection("Section 1",new FragmentIndex()));
        this.addSection(this.newSection("Section 2",new FragmentIndex()));
        this.addDivisor();
        this.addSection(this.newSection("Section 2",this.getResources().getDrawable(R.drawable.section2),new FragmentIndex()));
        this.addBottomSection(this.newBottomSection("Settings",this.getResources().getDrawable(R.drawable.settings),new FragmentSettings()));
    }

}

In your styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/light_blue_500</item>
        <item name="colorPrimaryDark">@color/light_blue_800</item>
        <item name="colorAccent">@color/grey_1000</item>
        <item name="windowActionBar">false</item>
    </style>

</resources>

N.B. Not override OnCreate method! Use init method instead.

How to import

Android Studio

Add this to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile 'it.neokree:MaterialNavigationDrawer:1.1'
}

You don't know how to do something? Visit the wiki!

screenshot screenshot screenshot screenshot

項目主頁:http://www.baiduhome.net/lib/view/home/1418011261636

 

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!