You can change the colour two ways; through XML or through coding. I would recommend XML since it’s easier to follow for beginners.
XML:
<Button android:background="@android:color/white" android:textColor="@android:color/black" />
You can also use hex values ex.
android:background="@android:color/white"
Coding:
//btn represents your button object btn.setBackgroundColor(Color.WHITE); btn.setTextColor(Color.BLACK);
Related Posts:
- You need to use a Theme.AppCompat theme (or descendant) with this activity
- You need to use a Theme.AppCompat theme (or descendant) with this activity
- How do I remove the title bar from my app?
- Why fragments, and when to use fragments instead of activities?
- Font size of TextView in Android application changes on changing font size from native settings
- Error inflating class fragment
- How to build a horizontal ListView with RecyclerView
- Getting activity from context in android
- How to make a round button?
- Android LinearLayout Gradient Background
- How to customize a Spinner in Android
- How to remove title bar from the android activity?
- What does ellipsize mean in android?
- What are the differences between LinearLayout, RelativeLayout, and AbsoluteLayout?
- How to make the corners of a button round?
- What is the difference between “px”, “dip”, “dp” and “sp”?
- How to inflate one view with a layout
- How do I get the currently displayed fragment?
- What exactly does fitsSystemWindows do?
- Determining translationX/Y values for ObjectAnimator; how to move a view to an exact screen position?
- What is the difference between gravity and layout_gravity in Android?
- Closing Application with Exit button
- Can I underline text in an Android layout?
- Android – border for button
- How to disable an Android button?
- Scrollview can host only one direct child
- How to remove title bar from the android activity?
- Failed to find style ‘coordinatorLayoutStyle’ in current theme
- How to use adb command to push a file on device without sd card
- This adb server’s $ADB_VENDOR_KEYS is not set
- Exception : AAPT2 error: check logs for details
- How can I find and run the keytool
- Android ADB devices unauthorized
- adb is not recognized as internal or external command, operable program or batch file
- Getting net::ERR_UNKNOWN_URL_SCHEME while calling telephone number from HTML page in Android
- Still getting warning : Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’
- java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference
- RecyclerView vs. ListView
- Android – Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23
- What does getActivity() mean?
- Session ‘app’: Error Installing APK
- How to update Notification with RemoteViews?
- How to fix: Error device not found with ADB.exe
- How to create a popup window (PopupWindow) in Android
- findViewById in Fragment
- ImageView in circular through XML
- Intel HAXM is required to run this AVD
- Unsupported method: BaseConfig.getApplicationIdSuffix()
- No Sound coming from Android Emulator [duplicate]
- Could not identify launch Activity: Default Activity not found
- Android: Difference between Parcelable and Serializable?
- PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)
- I am getting this error “your cpu doesn’t support vt-x or svm, android studio 2.1.1 in AMD 6300 processor”
- Adding an onclicklistener to listview (android)
- Android – Listen For Incoming SMS Messages
- What does “Failure [INSTALL_FAILED_OLDER_SDK]” mean in Android Studio?
- Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat
- How to create listview onItemclicklistener
- Android Studio-No Module
- Android Device not recognized by adb
- The application may be doing too much work on its main thread
- setOnClickListener error – cannot resolve symbol
- Why AVD Manager options are not showing in Android Studio
- Android Studio 3.0 Execution failed for task: unable to merge dex
- Error checking if Bluetooth is enabled in Android (REQUEST_ENABLE_BT cannot be resolved to a variable)
- Fragment MyFragment not attached to Activity
- onSaveInstanceState () and onRestoreInstanceState ()
- Getting android.content.res.Resources$NotFoundException: exception even when the resource is present in android
- Unsupported major.minor version 52.0 when rendering in Android Studioandroid android-studio rendering preview
- What is Sandboxed_process0 and why do i have so many instances of it listed in the memory usage for my app
- Android Facebook integration with invalid key hash
- Android dismiss keyboard
- How to decompile an android app from the google play store
- How do I center text horizontally and vertically in a TextView?
- Call to getLayoutInflater() in places not in activity
- How to add a jar in External Libraries in Android Studio?
- Adb backup does not work
- Android: How can I Convert String to Date?
- Your content must have a ListView whose id attribute is ‘android.R.id.list’
- Remove Project from Android Studio
- the item you requested is not available for purchase
- Service vs IntentService in the Android platform
- How to implement a confirmation (yes/no) DialogPreference?
- Android Studio Gradle DSL method not found: ‘android()’ — Error(17,0)
- installation app blocked by play protect
- C2DM: How to use C2D_MESSAGE permission?
- Android: No Activity found to handle Intent error? How it will resolve
- Cannot resolve symbol ‘AppCompatActivity’
- Android Studio – Emulator – eglSurfaceAttrib not implemented
- INSTALL_FAILED_NO_MATCHING_ABIS when install apk
- Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
- Start an activity from a fragment
- HAXM is not installed on this machine
- How to Resize a Bitmap in Android?
- What to use instead of “addPreferencesFromResource” in a PreferenceActivity?
- How to code using android studio to send an email
- HAX kernel module is not installed
- Cannot resolve symbol AppCompatActivity – Support v7 libraries aren’t recognized?
- WordPress post to android