Java Android按钮默认颜色:有时为灰色,有时为透明?
这是一个奇怪的例子,但我一直在Android Studio中制作一个应用程序,我有一个带有按钮的活动,看起来与其他活动中的按钮不同。此活动中的按钮是灰色的,而其他活动中的按钮是透明的。除了文本之外,我没有对它们做任何更改,除了它们是默认按钮。当我从其他活动中复制按钮时,复制的按钮也会变成灰色。我想这一定是某种来自活动设置的风格,但我不知道它是什么 具有透明按钮的活动中的XML:Java Android按钮默认颜色:有时为灰色,有时为透明?,java,android,android-studio,Java,Android,Android Studio,这是一个奇怪的例子,但我一直在Android Studio中制作一个应用程序,我有一个带有按钮的活动,看起来与其他活动中的按钮不同。此活动中的按钮是灰色的,而其他活动中的按钮是透明的。除了文本之外,我没有对它们做任何更改,除了它们是默认按钮。当我从其他活动中复制按钮时,复制的按钮也会变成灰色。我想这一定是某种来自活动设置的风格,但我不知道它是什么 具有透明按钮的活动中的XML: <RelativeLayout xmlns:android="http://schemas.android.co
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}"
android:background="@color/custom_yellow"
android:clickable="false"
android:id="@+id/rlLoginLayout">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bttnLogInText"
android:id="@+id/bttnLogIn"
android:onClick="logIn"
android:textColor="#000000"
android:layout_alignTop="@+id/chckbxKeepLoggedIn"
android:layout_alignRight="@+id/edttxtPassword"
android:layout_alignEnd="@+id/edttxtPassword" />
带有灰色按钮的活动中的XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}"
android:background="@color/custom_yellow"
android:clickable="false"
android:id="@+id/rlOptions" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Option 1"
android:id="@+id/bttnOption1"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:onClick="listOption1" />
舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testapp" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_login" >
</activity>
<activity
android:name=".OptionsActivity"
android:label="@string/title_activity_options" >
</activity>
</application>
发布两个xml的请帖,也发布声明活动的清单。添加这些代码位。发布两个xml的请帖,也发布声明活动的清单。添加这些代码位。