How to remove padding around buttons in Android?

In my Android app, I have this layout: <?xml version=”1.0″ encoding=”utf-8″ ?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <fragment android:id=”@+id/map” android:layout_width=”match_parent” android:layout_height=”0dp” android:layout_weight=”1″ class=”com.google.android.gms.maps.SupportMapFragment”/> <Button android:id=”@+id/button_back” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:onClick=”CloseActivity” android:padding=”0dp” android:text=”@+string/back” /> </LinearLayout> In the preview and on the phone, it looks like: As you can see on the button in the bottom area, there is … Read more

Coloring Buttons in Android with Material Design and AppCompat

Before the AppCompat update came out today I was able to change the color of buttons in Android L but not on older versions. After including the new AppCompat update I am unable to change the color for either version, when I do try the button just disappears. Does anyone know how to change the … Read more

How to center buttons in Twitter Bootstrap 3?

I am building a form in Twitter Bootstrap but I’m having issues with centering the button below the input in the form. I have already tried applying the center-block class to the button but that didn’t work. How should I fix this? Here is my code. <!– Button –> <div class=”form-group”> <label class=”col-md-4 control-label” for=”singlebutton”></label> … Read more

Best way to disable button in Twitter’s Bootstrap [duplicate]

This question already has answers here: What is the easiest way to disable/enable buttons and links (jQuery + Bootstrap) (16 answers) Closed 7 years ago. I am confused when it comes to disabling a <button>, <input> or an <a> element with classes: .btn or .btn-primary, with JavaScript/jQuery. I have used a following snippet to do … Read more

How to handle button clicks using the XML onClick within Fragments

Pre-Honeycomb (Android 3), each Activity was registered to handle button clicks via the onClick tag in a Layout’s XML: android:onClick=”myClickMethod” Within that method you can use view.getId() and a switch statement to do the button logic. With the introduction of Honeycomb I’m breaking these Activities into Fragments which can be reused inside many different Activities. Most … Read more

Android: combining text & image on a Button or ImageButton

I’m trying to have an image (as the background) on a button and add dynamically, depending on what’s happening during run-time, some text above/over the image. If I use ImageButton I don’t even have the possibility to add text. If I use Button I can add text but only define an image with android:drawableBottom and … Read more