All Questions
Tagged with material-components-android android-button
149
questions
0
votes
2
answers
62
views
What are these bunch of non-existence methods in material button google reference?
I tried to change material button icon programmatically and for this, Stackoverflow posts suggest that there is a frangible method called setCompoundDrawablesWithIntrinsicBounds.
I tried to find more ...
1
vote
1
answer
74
views
Why in different themes different buttons are created?
I have an usual button and a theme which is applied to android:theme in AndroidManifest file:
<Button
android:id="@+id/supperButton"
android:layout_width="match_parent"
...
1
vote
1
answer
98
views
how to set random color on a button in android
i am trying to make button which changes color when is pressed.
i have tried to use
button!!.backgroundTintList = ColorStateList(
arrayOf(intArrayOf(R.dimen.padding_large))
intArrayOf(panit!!...
0
votes
2
answers
193
views
Background adding more padding to Button
I have this simple XML file in my Android Studio. There are 2 buttons
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/...
0
votes
1
answer
111
views
Background for button not updating - Andorid
In my Android project, I have a button with a background of purple, but it is showing blue.
This is my code:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<...
3
votes
1
answer
1k
views
Why the icon on the button looks so big?
I'm trying to give an icon to the button but it looks like this!
XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:...
0
votes
2
answers
704
views
MaterialButton ClassCastException
Recently, we moved to use the material design theme for our app (we are using version 1.4.0). As part of this, we are converting explicit <com.google.android.material.button.MaterialButton ...
1
vote
2
answers
548
views
Android button: How to change icon programatically
I create a list of cards dinamically from XML data by inflating an XML layout. This layout has a button with dummy values to supress the warnings by the IDE, and I want to set the label and the ...
0
votes
2
answers
907
views
How to apply Material Theme to all buttons in application (activity)?
I'm trying to customize my Android theme, but nothing seems to work.
Activity:
public class MainActivity extends AppCompatActivity {
...
}
themes.xml
<resources xmlns:tools="http://schemas....
1
vote
1
answer
887
views
How to Override material design statepressed in for Android Button
Hello Learned Friends,
I am using Material Design Theme but I need to overried its statePressed so that when the button is clicked it changes color (highlighted for a moment) as demonstrated below.
...
2
votes
3
answers
3k
views
How do I create button with an icon in the center in Android?
I'm supposed to create a button with an icon in the center of the button next to the text like this:
This is the solution I came up with:
<androidx.cardview.widget.CardView
android:...
2
votes
3
answers
824
views
Circular button with drawable in the middle
I'm currently making the layout of an app I'm working on and I'm not able to create this button in xml.
The arrow inside is a .png picture (I can also get it exported as vector) and the background is ...
3
votes
1
answer
4k
views
How to create toggle button with icon and text
What would be the best way to build a togglebutton in android like shown in the image below. I spend more time than i like to admit trying to get it right but so far it seems inpossible to get rounded ...
2
votes
2
answers
54
views
how to make the setBackgroundColor work on all android versions in a button?
i would like to setBackgroundColor on a button in a ClickListener. i succeeded to do it but i noticed it works only with certains android versions. i tested it with a phone with android 4.4 it works ...
1
vote
1
answer
221
views
How to toggle only the background of a button and save the state (pressed or not)
I'm trying to make a survey app learning a bit about the FragmentContainerView and navigation graph. Everything works perfect when I use existing widgets such as radiobuttons or checkboxes for the ...