Does imageview have such an attribute so that this view element stays under the image dimensions?
Suppose we have a picture of 400x400. How to make imageview the same size (automatically, the size of the image may not be known).
In addition to setting wrap_content for height and width, it is still worth adding the adjustViewBounds property.
<ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/ic_launcher"/> wrap_content - the element will take as much as needed for the image.
android:layout_width="wrap_content" android:layout_height="wrap_content" Or you can get the size of the image in pixels, translate to dp and assign the length and width of the program
Source: https://ru.stackoverflow.com/questions/589944/
All Articles