android design 开源,GitHub - andreasschrade/android-design-template: This is a State of the Art Androi...

Material Design Android Template

First of all, a few screenshots:

Smartphone

Tablet

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f73637265656e2d6e65787573352e6a7067

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f73637265656e2d7461626c65742e6a7067

Collapsing Toolbar

Navigation Drawer

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f616e696d6174696f6e312e676966

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f73637265656e2d6e65787573352d322e6a7067

Support Design Library Views

Preferences

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f616e696d6174696f6e322e676966

687474703a2f2f7777772e616e64726561732d736368726164652e64652f6173736574732f65787465726e616c2f73637265656e2d6e65787573352d332e6a7067

What is this?

This is a State of the Art Android Material Design template. You can use this project as a template for upcoming App projects. Just clone the project, change package name and make all necessary customisations.

Dependencies

The focus of this project lies on the view layer and app navigation. It uses the following dependencies:

AppCompat Support Library

Support Design Library

Support Card View Library

Butterknife

Glide

Supported devices

The template support every device with a SDK level of at least 14 (Android 4+).

Quick walkthrough

Gradle

Nothing special here. Please note that the version of the support library is extracted to gradle.properties:

compile "com.android.support:appcompat-v7:${android_support_lib_version}"

compile "com.android.support:design:${android_support_lib_version}"

compile "com.android.support:cardview-v7:${android_support_lib_version}"

compile 'com.github.bumptech.glide:glide:3.6.1'

compile 'com.jakewharton:butterknife:7.0.1'

Manifest

There are only three Activities declared. The main theme is @style/Theme.Main.

Theme

The project contains three styles.xml.

res/values/styles.xml (basic colors, styles)

res/values-v21/styles.xml (contains Android 5 statusbar/systembar features)

res/values-sw600dp-land/styles.xml (used for tablet layout)

You can easily change the colors of your app. You only have to set the color values in colors.xml

#8BC34A

#1976D2

#2196F3

#FFF5F5F5

#B6B6B6

#212121

#727272

Navigation

The navigation drawer is configured in menu/drawer_view.xml:

android:id="@+id/nav_quotes"

android:icon="@drawable/ic_discuss"

android:title="@string/navigation_quotes" />

android:id="@+id/nav_samples"

android:icon="@drawable/ic_forum"

android:title="@string/navigation_samples" />

...

Base classes

BaseActivity is the parent class for every Activity inside this template. This class creates and provides the navigation drawer and toolbar.

BaseFragment is the parent for every Fragment class. It is responsible for view inflating and view binding (via ButterKnife).

Quotes View

The ListActivity is the start Activity and supports two differend layout modes:

One pane mode: Used on devices with a small screen size. The Activity shows only a list of all available quotes.

Two pane mode: Used on tablets and every device with a high screen size (>= 600dp width). The Activity shows the list of quotes and displays the selected item in a seperate Fragment.

Settings

The SettingsActivity represents some dummy preferences. You can easily configure your settings by modifying the settings_prefs.xml.

View Samples

The ViewSamplesActivity shows some stuff from the Support Design Library.

Butterknife is not only used for view binding, furthermore it is also used for configuring click listeners:

@OnClick(R.id.fab)

public void onFabClicked(View view) {

// floating action button clicked

}

For example, the following snippet (ArticleDetailFragment.java) binds automatically the view:

@Bind(R.id.quote)

TextView quote;

@Bind(R.id.author)

TextView author;

@Bind(R.id.backdrop)

ImageView backdropImg;

@Bind(R.id.collapsing_toolbar)

CollapsingToolbarLayout collapsingToolbar;

About

My name is Andreas Schrade and I am a freelance software developer with an interest in Android and Java backend development.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值