【发布时间】:2017-10-06 03:17:43
【问题描述】:
好的,所以我知道如何在 android 中使用可绘制背景来圆角。问题是,这也需要我手动设置按钮的颜色。如何在保持按钮主题颜色的同时更改圆角半径?
round_button.xml
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="40dp" />
<solid android:color="#80000000" />
</shape>
在activity_main.xml中
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_columnSpan="1"
android:layout_columnWeight="1"
android:layout_row="0"
android:background="@drawable/round_button"
android:text="Button" />
我只是希望主题颜色仍然应用于按钮,但也能够更圆角。
【问题讨论】:
-
你能用一个例子或一些代码描述你的问题吗?
-
@ANUJGUPTA 我添加了一些代码
标签: android android-drawable android-button android-styles