Giter Club home page Giter Club logo

Comments (12)

JakeWoki avatar JakeWoki commented on August 18, 2024 4

只看了下dialog的按钮部分,说错请见谅。
更改按钮颜色,没必要像这个库这样做。以下做法即可:

    <style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="buttonBarPositiveButtonStyle">@style/buttonBarPositive</item>
        <item name="buttonBarNegativeButtonStyle">@style/buttonBarNegative</item>
    </style>

    <style name="buttonBarPositive" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/positive</item>
    </style>

    <style name="buttonBarNegative" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/negative</item>
    </style>


new AlertDialog.Builder(getActivity(), R.style.AlertDialogCustom)
                    .setTitle("title")
                    .setMessage("message")
                    .setNegativeButton("canel", null)
                    .setPositiveButton("ok", null).create().show();

至于菜单类型、单选、多选和以下属性有关,如果全局统一使用同一个风格,改下面的属性即可。

     <style name="Base.AlertDialog.AppCompat" parent="android:Widget">
        <item name="android:layout">@layout/abc_alert_dialog_material</item>
        <item name="listLayout">@layout/abc_select_dialog_material</item>
        <item name="listItemLayout">@layout/select_dialog_item_material</item>
        <item name="multiChoiceItemLayout">@layout/select_dialog_multichoice_material</item>
        <item name="singleChoiceItemLayout">@layout/select_dialog_singlechoice_material</item>
    </style>

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

QMUI 是作为一个整体库存在,且很多组件都依赖于统一的 theme 和其他工具类。

请问你是想单独提取哪一部分?而作为一个整体库引入的话会给你带来什么不便吗?

from qmui_android.

caobin821651400 avatar caobin821651400 commented on August 18, 2024

dialog效果很漂亮,我想单独拿出来,可是依赖于theme会报错,最后还是放弃了,有时间在仔细研究下

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

单独提取一部分控件,除了需要把依赖到的工具类都提取出来,还需要把依赖到的 attr、theme 也提取出来,才能单独使用。
建议还是将 QMUI 作为一个整体引入,会比较方便。

from qmui_android.

ahhsfj1991 avatar ahhsfj1991 commented on August 18, 2024

必须要继承你们的主题,导致原先app有些地方写好的样式变了,能否绕过这个限制,不用继承你们的主题,仅仅使用控件的方案

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

目前不能绕过这个限制,因为许多组件都依赖主题里的样式,后续我们可能会优化这种使用方式。具体是哪些地方原先写好的样式变了?我们先查查

from qmui_android.

ahhsfj1991 avatar ahhsfj1991 commented on August 18, 2024

colorPrimaryDark,actionMenuTextColor,其他没具体看,视觉上的一一检查太麻烦了,让我没办法放心使用

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

因为一些组件默认样式的需要,我们在 qmui_themes_compat.xml 文件里的 <style name="AppConfigTheme.Compat"><style name="AppBaseTheme.Compat"> 中,覆盖了系统默认主题的一些值。目前如果需要将这些值改为其他值,可以在项目自己的 theme 中覆盖。
后面将会优化,尽量减少对系统默认表现的修改。

from qmui_android.

caobin821651400 avatar caobin821651400 commented on August 18, 2024

我建议设置样式颜色字体大小那些在代码中setXX比较好,但是你们改动会很大。

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

组件本身提供 setXXX 是合理的,但使用 theme 的初衷是为了方便在一个项目中快速配置控件的默认样式,所以 theme 的方式也不应该被废弃,只是 theme 不应该影响到该控件以外的样式。如果做到这样,是否能解决你的担忧?

from qmui_android.

ahhsfj1991 avatar ahhsfj1991 commented on August 18, 2024

能这样肯定是最好不过了

from qmui_android.

chanthuang avatar chanthuang commented on August 18, 2024

@JakeWoki 目前 QMUI 库里确实有不少冗余的属性,你提的这种做法也确实更合理,我们会考虑按这种方法进一步优化。感谢。

from qmui_android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.