I have an ImageButton
and I want to show a text and an image on it. But when I try on emulator:
<ImageButton
android:text="OK"
android:id="@+id/buttonok"
android:src="@drawable/buttonok"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
I get the image but without the text. How can I show the text? Please help me!
Guys I need to develop the setting and logout button, I used the below code.
you can use a regular
Button
and the android:drawableTop attribute (or left, right, bottom) instead.I solved this by putting the
ImageButton
andTextView
inside aLinearLayout
with vertical orientation. Works great!You can use a
LinearLayout
instead of usingButton
it's an arrangement i used in my appBest way:
Heres a nice circle example:
drawable/circle.xml
:And then the button in your xml file: