Android images and text in single view
I want to display text开发者_StackOverflow社区 ,images in single View . kindly help me also i want to give src of image from my class instead of xml kindly help thank you
You can use Button
for this
Button b=new Button(this);
b.setText(" Button");
b.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.btn_call), null, null);
Look at TextView here is link
look for android:drawableLeft,android:drawableRight,android:drawbleTop,android:drawbleBottom
to set drawable from class...look for setCompoundDrawablesWithIntrinsicBounds here is link
Hope this help.
You should try to use a normal button with drawableLeft / drawableRight / drawableTop / drawableBotton attribute.
See a sample here: How to create button with image & text
精彩评论