开发者

Android images and text in single view

开发者 https://www.devze.com 2023-03-18 05:32 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消