2,411 questions
0
votes
1
answer
58
views
Buttons layout to be rearrange after hiding any one so fill the first row first
I have six button in two Linear Layouts, three in each linear layout. But If I hide any button from any Linear layout they are rearranged accordingly in the same linear layout. But I required the If I ...
0
votes
1
answer
25
views
Layout attributes styling via a theme not working for buttons
The following is in AndroidManifest.xml:
<application
android:theme="@style/FooAppThemeStyle"
...
>
In style.xml:
<style name="FooAppThemeStyle&...
1
vote
1
answer
64
views
Android MaterialButtonToggleGroup buttons are getting offset when they have more than one line of text
I am using a MaterialButtonToggleGroup with MaterialButton buttons in it. I am trying to fit 2 lines of text into some of the buttons, but the buttons get shifted down a bit if they have more than one ...
3
votes
1
answer
192
views
Button with RepeatListener in Android does not change color when being pressed
I have a button in xml layout file
<Button
android:id="@+id/button_heat"
android:layout_width="0dp"
android:layout_height="0dp"
...
0
votes
0
answers
53
views
Issue with button colours. Button color is not changing as expected
I'm developing a quiz app. I want to change the button colour when the user selects it and then change it when the option is right or wrong. But the button color changes to grey even though I've not ...
1
vote
2
answers
2k
views
How to change the default color of Button in Jetpack Compose
Is there a way in Jetpack Compose to automatically apply the primary color defined in the theme to the background of Button composables without specifying the background color every time I use a ...
0
votes
1
answer
149
views
Button's backgroundTint doesn't change even though a color was specified
My goal is to create a button with rounded corners.
I have a button with this in its attributes android:background="@drawable/roundstyle", which is supposed to change the corners of the ...
0
votes
1
answer
43
views
setOnClickListener not works in Canvas and FrameLayout
I am making a qr code scanning screen. There is a camera view in the background and scanning animation on it. At the bottom there are two image views that I added programmatically. These image views ...
1
vote
3
answers
661
views
Why am I not able to use Text( ) inside Button( )'s onClick ={ }?
I am sheer beginner in Jetpack Compose library of Kotlin and I was making a simple UI to practice. I
Made a Button and I wanted to display a text in the event of someone clicking on code but I got an ...
0
votes
1
answer
48
views
Place textview on the left of button through toLeftTo but also align text to the left
Below is a simple UI design, I have set the Description attribute to stay at the left of the button by setting the android:toLeftTo, else the text would be blocked by the button if the description is ...
0
votes
1
answer
72
views
How do I get the current time to populate in the RecyclerView when I press the clockInOut button?
Ive been teaching myself how to code for the last 2 months and decided I would attempt to make a time keeping app. Ive checked everywhere in this code, I ran Logs, I even asked chatGPT, and for the ...
0
votes
1
answer
39
views
Creating a button style and adding a background
I want to create a style that changes the background of my button
I wrote this Style and it does what I want except it doesnt change the background of my button to the given drawable, it just stays ...
1
vote
2
answers
2k
views
How to use Segmented Buttons to switch between fragments?
I need to get the following design.
I need a way without using TabLayout/ViewPager.
There is no swipe required while switching in between the fragments.
Could you please help to understand how this ...
0
votes
2
answers
70
views
How to save a Button[] text in savedPreferences
I have Button[] buttons = new Button[9]; and later in the activity the buttons will be set to either X or O. I need to save whether a given button has its text as X or O. When a button is clicked on, ...
0
votes
0
answers
52
views
How to implement Android CustomButton by extends AppCompatButton
I have to implement custom button looks like next picture
and this,
button.xml (layout resource)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget....
0
votes
1
answer
1k
views
Android Jetpack Compose - Button With Leading Drawable
I have a simple Sign In screen and I have a problem with one of my Button. I just wanted to create a button has a drawable on start with a 10dp padding-start, and has a text on center of button.
Here ...
7
votes
3
answers
9k
views
Jetpack Compose: How to change color of a button border depending on if it is enabled or disabled?
Is it possible to change the color of the border .border( when it is disabled?
Something like ButtonDefaults.buttonColors to make border color Color.Gray if the button is disabled and keeping ...
0
votes
0
answers
28
views
Implement a Thread on a Button that adds items to a RecyclerView
In my app, I have 2 activities. The first activity is the main screen, and the second activity is the shop screen. The 2nd activity contains 2 fragments. I have 2 RecyclerViews located in the first ...
1
vote
1
answer
89
views
Android Buttons look different when added by code
I found that a button that is added to a layout by code looks very different than a button defined in xml.
I made a short example.
Here is the layout
<?xml version="1.0" encoding="...
0
votes
3
answers
1k
views
Change button text without changing the button width?
Consider the following code:
val saveInProgress = false // in reality might come from a ViewModel
Button(onClick = {}) {
val text = if(saveInProgress) "Save" else "..."
...
1
vote
1
answer
748
views
My button isn't square even when using: layout_constraintDimensionRatio="1:1" in Kotlin, android studio
I am trying to make an app using constraintlayout and guidelines. All works fine except when I'm trying to put a button.
Here is a screenshot of the design to show what the problem is: my button has a ...
0
votes
1
answer
2k
views
How can I give a button click feature only once in kotlin compose?
When a button is clicked once in kotlin compose, so if the button is clicked, I want it not to be clicked again. Is there a simple way to do this in kotlin compose?
0
votes
1
answer
43
views
How to click on a button inside list element of a RecyclerView?
So I have recyclerview here, and I want to delete a specific element by clicking on that element's delete button (here, the trash icon is the image button). How do I do it?
3
votes
1
answer
7k
views
Jetpack Compose: Is it possible to call an Composable function on a button click in another Composable function?
When I tried to write text, on a buttonClick event, I ran into the problem, that I can't call a @Composable function inside another function because of the: @Composable invocations can only happen ...
0
votes
1
answer
336
views
How to subset a font so that remaining characters keep original sizes?
I am subsetting font M PLUS 1p (style medium). I need only a single character - leftwards arrow, which is unicode character u2190. During the subsetting process FontForge complained that the lookup ...