Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android studio change button color programmatically

// If you're in an activity:
Button11.setBackgroundColor(getResources().getColor(R.color.red));
// OR, if you're not: 
Button11.setBackgroundColor(Button11.getContext().getResources().getColor(R.color.red));
Comment

button color wont change android studio

//Add this to your button xml element

android:background="@android:color/[INSERT_COLOR]"
//You might have to change the text color to make the text readable

//Change this line in both of the themes.xml files

<style name="Theme.[INSERT_APP_NAME]" parent="Theme.MaterialComponents.DayNight.DarkActionBar">

//to 

<style name="Theme.[INSERT_APP_NAME]" parent="Theme.AppCompat.DayNight.NoActionBar">

// you can change the .NoActionBar to light action bar or dark action bar if you want to
Comment

android studio change button color programmatically

Button11.setBackgroundColor(0xFFFF0000); // 0xAARRGGBB
Comment

android studio change button color programmatically

startBtn.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
Comment

cant change button color when app run android studio

replace <Button with <androidx.appcompat.widget.AppCompatButton
Comment

PREVIOUS NEXT
Code Example
Java :: how to check duplicate string in java 
Java :: java creating a stack 
Java :: spring properties list 
Java :: java set classpath 
Java :: java asynchronous programming example 
Java :: java calendar 
Java :: and roid shape setCornerRadii 
Java :: align button to the left in JPanel 
Java :: how to find the length of an array in java 
Java :: java map tostring 
Java :: int to char java 
Java :: java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config 
Java :: quicksort java 
Java :: ClassNotFoundException: org.springframework.ui.freemarker.FreeMarkerConfigurationFactory 
Java :: add infinite values to variable java 
Java :: spring mvc project example 
Java :: interface java 
Java :: give ram to java 
Java :: convert jwt claim to string java 
Java :: what are variables in java 
Java :: mod 10e9+7 in java 
Java :: how to hash string in java 
Java :: Implement the static keyword – static variable, static block, static function and static class with following conditions 
Java :: has been compiled by a more recent version of the Java Runtime (class file version 55.0) 
Java :: byte array in java 
Java :: java program to search item from name in class 
Java :: isWhiteSpace java 
Java :: scaletype android dynamic 
Java :: 2-dimensional Array java 
Java :: Java void Keyword 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =