【问题标题】:How to Use Material Design in Android App?如何在 Android 应用中使用 Material Design?
【发布时间】:2015-03-08 06:46:00
【问题描述】:

我已经查看了 Android 开发者文档以了解如何使用 Material Design,这里:

https://developer.android.com/training/material/theme.html

这里:

https://developer.android.com/training/material/get-started.html

本质上,我希望有人总结一下如何设置/使用材料设计,因为我觉得开发人员文档上有很多信息,我似乎无法围绕它进行思考。 如果您愿意给我一个指向其他人创建的指南的链接,那也会很有帮助。

我也在使用 API 级别 19(目标 SDK 版本 19),据我所知,我需要使用 com.android.support:cardview-v7:21.0.+

我也在使用 Android Studio,而不是 eclipse。

编辑:我希望能够为未运行 Android 5.0 Lollipop 的设备使用 Material Design,因为根据 Android 分布数据,运行 Lollipop 的设备不到 0.1%:Android Distribution Data

【问题讨论】:

    标签: android android-studio material-design


    【解决方案1】:

    安装 Android 5.0 SDK 的 SDK 平台,然后通过 SDK-Manager 将您的支持库和支持库更新到最新版本。

    看看这个链接创建材料应用程序

    http://developer.android.com/training/material/index.html

    借助支持库,您可以在旧设备上提供类似的行为,例如:

    • 使用 Material 主题
    • UI 小部件的子集,例如
      • EditText
      • Spinner
      • RadioButton

    也可以看看android design support library

    更多信息:

    但是要在您的应用程序中使用诸如FloatingActionButton 之类的一些概念,您可以使用这个库: https://github.com/makovkastar/FloatingActionButton

    这里有更多的库

    https://android-arsenal.com/

    【讨论】:

    • 是的。我已经浏览了所有这些。我还编辑了我的原始帖子。我想为不运行 Android 5.0 的设备使用材料设计,但开发人员文档对如何做到这一点并不完全清楚。我明白它说什么,也读过它,但我觉得一切都混在一起了。
    • 太棒了。感谢您的指导。我会调查他们,希望一切顺利。
    【解决方案2】:

    在 appcompat_v7 支持库中使用以下样式:

    AndroidManifest.xml

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyMaterialTheme" >
        ......
    </application>
    

    样式.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>
    

    这是我在 5.0 以下的 Material Design 演示项目,带有工具栏和回收器视图: MaterialDesign_Part1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-30
      • 1970-01-01
      • 1970-01-01
      • 2016-08-18
      • 2017-09-12
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      相关资源
      最近更新 更多