Answer the question
In order to leave comments, you need to log in
What is causing the ImageView resizing error?
I want to make the width and height of the ImageView change depending on the screen resolution (0.8 * display_width and display_height * 0.8), and I found this way for this, but when the application starts, it immediately dies, how to fix it?
<code lang="java">
ImageView spaceadventure = (ImageView) findViewById(R.id.imageView);
float density = getApplicationContext().getResources().getDisplayMetrics().density;
spaceadventure.setLayoutParams(new AbsListView.LayoutParams((int) (density * 1), (int) (density * 1)));
</code>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question