标签: material-design

导航抽屉半透明状态栏无法正常工作

我正在开发Android项目,我正在实现导航抽屉.我正在阅读新的材料设计规范材料设计清单.
规范说滑出窗格应该浮动在其他所有内容之上,包括状态栏,并且在状态栏上是半透明的.

我的导航面板位于状态栏上,但没有任何透明度.我按照Google开发者博客网站上的建议点击了这篇SO帖子中的代码,上面的链接如何使用DrawerLayout显示在ActionBar /工具栏上和状态栏下?.

下面是我的XML布局

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <android.support.v7.widget.Toolbar
            android:id="@+id/my_awesome_toolbar"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:minHeight="?attr/actionBarSize"
            android:background="@color/appPrimaryColour" />
    </LinearLayout>
    <LinearLayout android:id="@+id/linearLayout"
        android:layout_width="304dp"
        android:layout_height="match_parent"
        android:layout_gravity="left|start"
        android:fitsSystemWindows="true"
        android:background="#ffffff">
        <ListView android:id="@+id/left_drawer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:choiceMode="singleChoice"></ListView>
    </LinearLayout>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

以下是我的应用主题

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/appPrimaryColour</item>
        <item name="colorPrimaryDark">@color/appPrimaryColourDark</item>
        <item name="colorAccent">@color/appPrimaryColour</item>
        <item name="windowActionBar">false</item>
        <item name="windowActionModeOverlay">true</item>

    </style>
Run Code Online (Sandbox Code Playgroud)

以下是我的应用程序v21主题

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/appPrimaryColour</item>
    <item name="colorPrimaryDark">@color/appPrimaryColourDark</item>
    <item name="colorAccent">@color/appPrimaryColour</item>
    <item name="windowActionBar">false</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)

下面是我的onCreate方法 …

android navigation-drawer material-design android-5.0-lollipop

81
推荐指数
6
解决办法
9万
查看次数

应用Material Design Touch Ripple到ImageButton?

我有一个图像按钮,点击它时没有响应触摸动画,因为它是一个静态图像,而不像棒棒糖上的常规按钮带有内置的连锁效果.我想将材料设计波纹触摸效果添加到图像中,但似乎无法找到实现它的方法.我可以在图像上设置一个滤色器,但这不是涟漪效应.我正在尝试做的一个例子就是当你在Google Play音乐中保存一个专辑封面图像并且阴影波纹在图像上移动时.

xml android imagebutton material-design android-5.0-lollipop

81
推荐指数
4
解决办法
4万
查看次数

FloatingActionButton包含文本而不是图像

我试图找出如何从android支持库修改FloatingActionButton.它可以与文本而不是图像一起使用吗?

像这样的东西:

在此输入图像描述

我看到它扩展了ImageButton所以我认为不是.我对吗?

这在材料设计方面是否正确?

android android-support-library material-design floating-action-button

77
推荐指数
6
解决办法
6万
查看次数

Android如何从Material Design文档实现底部工作表

你如何实现底部表格规定? http://www.google.com/design/spec/components/bottom-sheets.html

Google云端硬盘的新更新通过按下浮动操作按钮显示了这一点 - >

在此输入图像描述

当然,规格从来没有说过任何关于圆角的内容,无论是否可行,只是不确定如何去做.目前使用AppCompat库并将目标设置为21.

谢谢

android material-design floating-action-button android-5.0-lollipop

75
推荐指数
6
解决办法
7万
查看次数

Android材料设计按钮 - 前棒棒糖

如何实施谷歌材料设计指南中描述的"凸起按钮"和"平面按钮"?


凸起的按钮为大多数平面布局增加了尺寸.他们强调繁忙或宽阔空间的功能.

凸起的按钮


使用工具栏和对话框的平面按钮可避免过度分层.

平面按钮

资料来源:http://www.google.com/design/spec/components/buttons.html

android button material-design

75
推荐指数
2
解决办法
9万
查看次数

工具栏中的材料"关闭"按钮而不是"后退"

我在谷歌的收件箱应用程序中看到,编写一个新的电子邮件,在工具栏中而不是后退按钮(箭头),它有一个"关闭"按钮(见图片).

我怎样才能做到这一点?

收件箱撰写关闭按钮

android android-actionbar material-design

75
推荐指数
4
解决办法
4万
查看次数

如何为Button提供阴影

在此输入图像描述

正如你在图像中看到的那样,我想要一个背后的阴影Button.我创造Button了圆角.但问题是我不能在背后产生阴影Button.我怎样才能做到这一点?

android shadow material-design

74
推荐指数
5
解决办法
19万
查看次数

Android AppCompat 21提升

有没有办法View在前棒棒糖设备中添加高程而不将它们包裹在CardView

android android-view material-design

74
推荐指数
3
解决办法
7万
查看次数

如何在材料设计导航抽屉中更改汉堡包图标的颜色

我正在关注这个例子

http://www.androidhive.info/2015/04/android-getting-started-with-material-design/

在这个例子中它显示白色汉堡图标,我想自定义它并使其变黑,但我无法找到任何如何更改它,任何人都可以告诉如何自定义它?

表现

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="info.androidhive.materialdesign" >


    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyMaterialTheme" >
        <activity
            android:name=".activity.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

样式

<resources>

    <style name="MyMaterialTheme" parent="MyMaterialTheme.Base">

    </style>

    <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="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="homeAsUpIndicator">@drawable/hamburger</item>
    </style>

</resources>
Run Code Online (Sandbox Code Playgroud)

主要活动

public class MainActivity extends AppCompatActivity implements FragmentDrawer.FragmentDrawerListener {

    private static String TAG = MainActivity.class.getSimpleName();

    private Toolbar mToolbar;
    private FragmentDrawer drawerFragment;

    @Override
    protected void …
Run Code Online (Sandbox Code Playgroud)

java user-interface android navigation-drawer material-design

74
推荐指数
6
解决办法
5万
查看次数

如何在NavigationView中自定义项目背景和项目文本颜色?

我想实现Material Design Docs中显示的类似内容.

colorControlHighlight 用于检查项目的背景.

我需要自定义:

  • 背景未经检查
  • 文字颜色检查
  • 文本颜色未选中

android drawerlayout material-design android-design-library navigationview

73
推荐指数
6
解决办法
7万
查看次数