相关疑难解决方法(0)

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

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


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

凸起的按钮


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

平面按钮

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

android button material-design

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

Android 5.0 android:提升适用于View,但不适用于Button?

在SDK Manager的Android 5.0示例中,有ElevationBasic示例.它显示了两个View对象:圆形和方形.圆圈android:elevation设置为30dp:

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2014 The Android Open Source Project

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF …
Run Code Online (Sandbox Code Playgroud)

android android-5.0-lollipop

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

MaterialComponents主题警告对话框按钮

最近我从支持库切换到com.google.android.material:material:1.0.0

但是现在我有一个问题,在这个页面上有一个注释https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md

注意:使用"材质成分"主题可启用自定义视图填充程序,该填充程序将使用"材质"对应项替换默认组件.目前,这仅使用MaterialButton替换Button XML组件.

我正在使用的主题

Theme.MaterialComponents.Light.NoActionBar
Run Code Online (Sandbox Code Playgroud)

它完全按照它在说明中所说的,它将AlertDialog按钮替换为MaterialButtons,但问题是默认情况下MaterialButtons是彩色背景,现在按钮看起来像这样: 在此输入图像描述

我怎样才能让它们再次无边界和无背景?

PS我正在使用警报构建器来创建警报对话框:

android.app.AlertDialog.Builder
Run Code Online (Sandbox Code Playgroud)

android android-alertdialog android-styles material-design material-components-android

49
推荐指数
7
解决办法
8552
查看次数

Android L - 浮动操作按钮(FAB)

Google是否已经为这个新的循环FAB按钮发布了已定义的样式或组件,还是应该自行实现该设计?

按钮在此处描述:Google Design | 浮动动作按钮

编辑(05/2015):检查Lukas的回答/Gabriele的答案显示了使用设计支持库实现它的简单方法.

java android material-design android-5.0-lollipop android-design-library

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

如何模仿Material-design凸起的按钮样式,即使对于前Lollipop(减去特殊效果)?

谷歌已经展示了一些很好的方式,按钮在这里显示在棒棒糖上.

我在谈论凸起和平面按钮.

除了特殊效果(波纹等......)之外,我怎样才能在Lollipop前版本上模仿它们?

我在说这个这个.

当然,在棒棒糖及以上,我想使用特效.

我知道有很多(甚至很多)关于这个的帖子,但我没有看到任何试图完全模仿它.

android android-button material-design android-5.0-lollipop

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

材质按钮上的圆角

我下面从这样的问题提示创建一个按钮样式像材料设计建议.

按键

但是,我需要通过继承Widget.AppCompat.Button.Colored样式和设置radius参数来更改角半径并且无法这样做.

我怎么能有相同的风格,但有圆角?

android android-button android-support-library material-design android-support-design

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

如何将材质设计库导入Android Studio?

我想在Android Studio v1.0.0 rc2中将此库导入我的项目:

https://github.com/navasmdc/MaterialDesignLibrary

但有一个问题.当我将此库添加为模块时,会出现此错误:

错误:依赖项MyApplication.libraries:MaterialDesign:项目应用程序未指定解析为APK归档文件,不支持作为编译依赖项.文件:C:\ ADTBundle\StudioWorkspace\MyApplication\libraries\MaterialDesign\build\outputs\apk\MaterialDesign-release-unsigned.apk

什么是解决这个问题的分步指南?或者这个库的gradle依赖是什么?

android gradle android-studio material-design

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

如何在主题中全局更改android按钮文本颜色

如何更改所有按钮的文字颜色?

我知道我可以设置背景颜色如下:

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="colorButtonNormal">@color/buttonColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)

如何为按钮Text执行此操作?

android android-button material-design material-components material-components-android

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

如何正确删除Android中按钮周围的填充(或边距?)?

目前,我有以下底部登录按钮.

没有按下按钮时

在此输入图像描述

按下按钮时

在此输入图像描述

XML看起来像这样

<LinearLayout
    android:background="?attr/welcomeBottomNavBarBackground"
    android:orientation="horizontal"
    android:id="@+id/sign_in_bottom_nav_bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">
    <Button
        style="?android:attr/buttonBarButtonStyle"
        android:id="@+id/sign_in_button"
        android:layout_width="0dp"
        android:width="0dp"
        android:layout_weight="1.0"
        android:layout_height="48dp"
        android:gravity="center"
        android:layout_gravity="center"
        android:enabled="true"
        android:textAllCaps="true"
        android:text="@string/log_in" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我想在按下按钮时删除按钮周围的填充(或者我应该将其称为边距?请参阅我最底部的p/s部分).

我看看如何删除Android中的按钮周围的填充?

我试过了

<Button
    ...
    ...
    android:minHeight="0dp"
    android:minWidth="0dp" />
Run Code Online (Sandbox Code Playgroud)

它不起作用也没有效果.


我进一步尝试

<Button
    ...
    ...
    android:background="@null"
    android:minHeight="0dp"
    android:minWidth="0dp" />
Run Code Online (Sandbox Code Playgroud)

按下时不再填充.然而,设计压制视觉效果的材料也将消失.

我可以知道在压制过程中删除按钮填充的最佳方法是什么,但保留材料设计按下的视觉效果?

P/S

我真的不知道是否应该称之为填充或边距.我希望实现的是,当我们按下底部区域时,按下视觉效果变化应覆盖整个100%底部区域(@+id/sign_in_bottom_nav_bar),而不是当前95%的底部区域.

java android android-layout android-button android-view

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

使用Material Button会产生ClassNotFound运行时错误

我正在使用<com.google.android.material.button.MaterialButtonXML文件和private MaterialButton dateButton;Java片段文件中的Material Buttons替换我的应用程序中的按钮.我研究了代码实验室" MDC-101 Android:Material Components(MDC)Basics(Java) "以了解如何使用Material Button.在gradle.build(Module:app)文件中,我添加了代码实验室中的依赖项.代码实验室编译并运行良好.我的应用程序编译正常,但在膨胀片段布局时出错:

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: nl.kl_solutions.schedulecompareforzermelo, PID: 16708
              android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class com.google.android.material.button.MaterialButton
              Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.android.material.button.MaterialButton
              Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.material.button.MaterialButton" on path: DexPathList[[zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/base.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_dependencies_apk.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_resources_apk.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_slice_0_apk.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_slice_1_apk.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_slice_2_apk.apk", zip file "/data/app/nl.kl_solutions.schedulecompareforzermelo-o6fuvqQPirym08EhaTRI6Q==/split_lib_slice_3_apk.apk", zip file …
Run Code Online (Sandbox Code Playgroud)

android material-design

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