material design风格的导航抽屉Activity:MaterialNavigationDrawer

jopen 10年前

拥有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.open-open.com/lib/view/home/1418011261636