Many people have questions about imagebutton provided by Android. When a drawable image is displayed, text is no longer displayed. There are three solutions:
First, the text is written into the image, but this will increaseProgramAnd the hard coding method will affect the release of multiple languages.
Solution 2: the solution is very simple. Through analysis, we can see the layout of imagebutton. We can directly inherit it and add a textview. The alignment is on the right side to enable imagebutton to support displaying the right side of the text.
Third: a more concise and efficient method: Use the button and set the Android: drawableleft and other properties of the button. Example:
<Button
Android: Id = "@ + ID/button1"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: drawableleft = "@ drawable/icon"
Android: text = "button"
/>
Type 4: Layout multiple layers
<Linearlayout
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: Orientation = "vertical"
Android: Id = "@ + ID/BT">
<Imageview
Android: Id = "@ + ID/IB"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: src = "@ drawable/ringlove"
Android: Background = "#00000000"
/>
<Textview
Android: Id = "@ + ID/TV"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/cs"
Android: paddingleft = "20px"
/>
</Linearlayout>