我想在我的Android应用程序中使我的按钮透明,但是当我使用
时 android:background="@android:color/transparent"
它也使我的按钮上的文字不可见,我想避免这种情况。有没有办法让透明按钮上的文字可见?
这是我的按钮的完整代码:
<Button
android:id="@+id/Button01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.01"
android:onClick="scanName"
android:orientation="center"
android:background="@android:color/transparent"
android:text="@string/tap to start scanning" />
答案 0 :(得分:4)
您是否尝试为按钮设置android:textColor?
答案 1 :(得分:2)
使用 android:background =“#0000”
答案 2 :(得分:1)
试试这个,将文字颜色设置为你想要的颜色。现在它是红色的(#9a0a0a)。
<Button
android:id="@+id/Button01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#9a0a0a"
android:layout_weight="0.01"
android:onClick="scanName"
android:orientation="center"
android:background="@android:color/transparent"
android:text="@string/tap to start scanning" />