Reputation: 103
I have created one image in ms-paint and moved that to my drawable folder. Now I want that it should resize automatically depending upon device or screen orientation.
Also, I am using this image inside TextView and using below code for that:
text.setText(Html.fromHtml(content, new ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Drawable drawFromPath;
int path = getActivity().getResources().getIdentifier(
source, "drawable",
"com.ssand.app.edu.finaccouting");
drawFromPath = (Drawable) getActivity().getResources()
.getDrawable(path);
drawFromPath.setBounds(0, 0,
drawFromPath.getIntrinsicWidth(),
drawFromPath.getIntrinsicHeight());
return drawFromPath;
}
}, null));
How can i achieve this ?
Upvotes: 0
Views: 468
Reputation: 51
You need to create images suitable to all the devices screens sizes and orientations and keep them in corresponding res/drawable folder like drawable-hdpi, drawable-ldpi, etc. Also, create suitable layouts and keep them in corresponding res/layout folders like /layout and /layout-land. Hope this helps.
Upvotes: 1