问题
I've gone to the Android Developer documentation to see how I can use material design, here:
https://developer.android.com/training/material/theme.html
and here:
https://developer.android.com/training/material/get-started.html
Essentially, I would like for someone to summarize how to set up/use material design, because I feel like there is a lot of information on the developer docs, and I can't seem to wrap my mind around it. If you'd rather give me a link to a guide created by someone else, that'd be helpful as well.
I'm also using API level 19 (target SDK version 19) and from what I can see, I'll need to use com.android.support:cardview-v7:21.0.+
I'm also using Android Studio, and not eclipse.
EDIT: I would like to be able to use material design for devices that are not running Android 5.0 Lollipop, because according to the Android distribution data, there are less than 0.1% of devices running Lollipop: Android Distribution Data
回答1:
Install SDK platform of Android 5.0 SDK then update your Support Library and Support Repository to the latest version via the SDK-Manager.
Take a look at this link for creating material app
http://developer.android.com/training/material/index.html
With support libraries, you can provide similar behaviour on older devices like:
- Using the Material Theme
- Subset of UI widgets like
EditTextSpinnerRadioButton
Also take a look at android design support library.
More information :
- https://chris.banes.me/2014/10/17/appcompat-v21/
- http://android-developers.blogspot.co.uk/2014/10/appcompat-v21-material-design-for-pre.html
- https://developer.android.com/training/material/compatibility.html
But for using some concepts like FloatingActionButton in your application you can use this library :
https://github.com/makovkastar/FloatingActionButton
More libraries available here
https://android-arsenal.com/
回答2:
Use following style with appcompat_v7 support library:
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyMaterialTheme" >
......
</application>
styles.xml
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
</style>
Here is my demo project for Material Design below 5.0 with Toolbar and Recycler view: MaterialDesign_Part1
来源:https://stackoverflow.com/questions/27869167/how-to-use-material-design-in-android-app