Reputation: 369
There is my layout in android xml, but the image does not in the top of the layout. What can be the problem?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView android:id="@+id/description_imageview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hand"
android:contentDescription="@string/app_version"/>
<TextView android:id="@+id/first_help_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="sdsjkfhsdjkfhsdkjfh skdfjh skjdfh skdjfh skjdfh skjdfh skjdhfk jshdfkjh jskdfh skjdfh skdjfh skdjfh skdjfh skjdfh skjdfh skjdfh kjsdhf kjsdhfk jhs"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
add scale_type:
Upvotes: 0
Views: 478
Reputation: 464
<ImageView android:id="@+id/description_imageview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hand"
android:contentDescription="@string/app_version"
android:layout_marginTop="-5dp"
/>
Upvotes: 0
Reputation: 10395
try Setting scaleType
to your ImageView
android:scaleType="fitXY"
Edit : Try Changing LinearLayout height :
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Upvotes: 1
Reputation: 1731
might be your image having white spaces or you can say some area covered by image is null
either crop your image first and eliminate all white space
<ImageView android:id="@+id/description_imageview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hand"
***android:scaleType="fitXY"***
android:contentDescription="@string/app_version"/>
Upvotes: 1