【问题标题】:Custom button style on androidandroid上的自定义按钮样式
【发布时间】:2016-07-24 00:56:26
【问题描述】:

我正在使用以下链接创建一个自定义按钮。我跟着每一步。 https://androidcookbook.com/Recipe.seam?recipeId=3307

然后我通过以下方式创建了一个按钮:

   <Button
    android:id="@+id/btnButton1"
    android:layout_width="95dp"
    android:layout_height="wrap_content"
    android:buttonStyle="@style/button"
    android:text="CREATE"
    android:onClick="createButtonClickHandler"/>

但我看到我的按钮有默认样式。我希望我的按钮具有这种新奇特的自定义样式。

【问题讨论】:

    标签: android


    【解决方案1】:

    不要使用buttonStyle,只使用style

       <Button
        android:id="@+id/btnButton1"
        android:layout_width="95dp"
        android:layout_height="wrap_content"
        android:style="@style/button"
        android:text="CREATE"
        android:onClick="createButtonClickHandler"/>
    

    参考:https://developer.android.com/guide/topics/ui/themes.html

    【讨论】:

    • 在构建应用程序时出现以下错误:错误:(11) 在包 'android' 中找不到属性 'style' 的资源标识符
    • 那么,这个问题可能会对你有所帮助:stackoverflow.com/questions/26070827/…
    • 按钮制造商链接帮助我部分解决了我的问题。
    猜你喜欢
    • 2015-07-05
    • 2016-11-17
    • 1970-01-01
    • 2021-09-17
    • 2015-10-04
    • 1970-01-01
    • 2016-03-16
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多