I fill TextView from resources, there is a need to insert a picture into the text, is there such a possibility?
2 answers
If there is text in a TextView, then in this example the figure will be on the left (actually the text on the right):
TextView textView = (TextView)findViewById(R.id.textview); Drawable img = getResources().getDrawable(R.drawable.image); img.setBounds(0, 0, 50, 50); textView.setCompoundDrawables(img, null, null, null);
|
If you know in advance which picture needs to be inserted into a TextView, then it is better to do it directly in the layout file. As an example, you can see this answer.
|