2013-05-08 63 views
1

我想添加一个图像在按钮上的文字。如果我添加图像作为按钮的背景,它会被添加到文本下方。预期结果将添加为图像。请帮助安卓按钮文本交叉(错误符号)图像

Text below the image

更新: 我需要以编程方式做到这一点。

+0

添加一个TextView和ImageView的一个FrameLayout里内 – JiTHiN 2013-05-08 11:59:29

回答

1

在XML中,

<RelativeLayout android:id="@+id/container">* 
    <TextView ...></TextView> <!-- Your A text --> 
</RelativeLayout> 

在代码中,

RelativeLayout container = (Rel...) findViewById(R.id.container); 
ImageView imgView = new ImageView(this); 
// Set Image View params and image and add it programmatically 
container.addView(imgView); 
+0

感谢的要求,我想有它的一个按钮。 – user1611248 2013-05-13 15:27:07