【发布时间】:2020-03-31 00:36:33
【问题描述】:
我最近在 Android Studio 中为一件事而苦苦挣扎。我不知道如何设置(或者是否有可能)按钮中的文本与 Activity 中的背景具有相同的颜色(或根本没有颜色)。我的意思是说: I want this white text in black button to be the same color as App background (gradient)
按钮 XML:
<Button
android:id="@+id/startButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:background="@drawable/button"
android:fontFamily="@font/amiko"
android:text="START"
android:textColor="#ffffff"
android:textStyle="bold" />
按钮形状 XML:
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000"/>
<corners android:radius="30dp" />
</shape>
我尝试将 Button 中的文本颜色设置为透明,但它变成了黑色,就像按钮颜色一样。
【问题讨论】:
标签: android xml android-studio