Questions tagged [android-button]

questions about the android.widget.Button element. This element can be used on activities.

On Android, buttons can be generated programmatically in Java code or by using xml layouts. Usually a listener(OnClickListener) is set on the Button to receive an event when the user touches the Button. The listener can be set in code or by using the android:onClick attribute in the xml layout, setting it to point to a method written in the Activity class.

Initial help

2399 questions
0
votes
0 answers

How to change text from constructor in custom Button

I have a custom Button view. Where I want to get the current text from attributes, modify it and show it. public class GreenRoundedButton extends AppCompatButton { public GreenRoundedButton(Context context, AttributeSet attrs) { super(context,…
kike
  • 4,255
  • 5
  • 23
  • 41
0
votes
1 answer

How to put round Buttons next to an Include

I have created small rounded buttons and trying to put them right next to an include but I can't seem to get the round buttons next to the include. I can only get the rounded buttons above the include. What I have gotten What I would like to…
AnonymousZA
  • 121
  • 1
  • 11
0
votes
1 answer

Displaying images in an imageviewer

The initial goal of the buttons is to allow the user to save an image into an imageviewer. This works, but the method I used stores the images into an imageviewer. It will not allow me to save the image into another imageviewer when another button…
0
votes
4 answers

Is it ok to use png as a button background?

Is there is any drawback of using png as a background for a Button or EditText. Or should I write a code for XML for background of Button or EditText. I want to know which is the better way.
0
votes
4 answers

how to set different onclicklisteners on same button click?

I am implementing a timer in android with one text view and one button for start/stop. How do I set register different events on clicklistener of the same button, such that when it is clicked the first time it will start a timer and when clicked a…
user8863067
0
votes
1 answer

How to place Spinner with specific background without affecting the drop down?

I need to use Spinner with center text with background outline. But when I applied for Button, it works fine. But the same when I replaced with Spinner, the drop down is not visible and text is not center. The below one for Button works fine with…
0
votes
2 answers

Special button shape (slightly rotated arrow)

I need your help with the following shape i want to use for a button in an android app: I've tried creating a custom XML background and use it for a button, but it wasn't what I've wished for. What would be the most elegant way to implement this? I…
0
votes
2 answers

Toast makes Activity blink on button click

I have button at the top of sreeen and camera preview at beneath, when I press button screen is blinking, but want it to show Toast. It stopped to blink after I commented out Toast.makeText(), and log shows that button was clicked. Component tree…
0
votes
1 answer

Button doesn't work on a new thread

Previously I had error - something about some loop, I've seen info that it is necessary in that case to start a new thread for button, but still nothing happens, thought logs show no errors now. import android.content.Context; import…
Andy D
  • 125
  • 13
0
votes
1 answer

Override Button to draw text upside down

How could I go about overriding the Button class to draw the text upside down? The formatting of other libraries I'm using screw up when the button itself it rotated, but I need the text flipped. I'm not familiar with the onDraw method, and I'm not…
DXHHH101
  • 13
  • 6
0
votes
1 answer

Pressing 2 buttons simultaneously in android app, no simple solution?

public class TwoPlayers extends AppCompatActivity implements View.OnClickListener { private Button start, start2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Tom
  • 53
  • 1
  • 10
0
votes
0 answers

Changing Android's "UP" navigation button

When going from Page 2 back to Page 1, I created a custom button with custom slide left/right animation between Page 1 and Page 2. Then obviously the "UP" button uses a default animation to go from Page 2 back to Page 1. I'm referring to the…
iBEK
  • 622
  • 2
  • 8
  • 27
0
votes
1 answer

How to create an Button with an image, text, and two colours?

Here is the link to what I have in mind. https://dribbble.com/shots/1407665-Categories/attachments/204971 Is there a popular library anyone knows that can manage this, otherwise I am alright with going the customizing route. I have my 9 buttons…
0
votes
0 answers

Trianguler Buttons in Android Studio

Triangle Design Buttons Hi everyone. I want to draw buttons like as shown in image. What is best to draw triangle buttons XML or Java Code for multi support screen?
0
votes
3 answers

RadioButton Issue get checked when sending?

Having two RadioButtons and button send. When I click on the send button the 2 RadioButtons are checked. How to avoid this? enter image description here
1 2 3
99
100