I have a problem, to show my image in android.
For this, you can see below the output of my emulator.
I have a ScrollView
with 2 childrean.
One is the TextView
, and the other one is the ImageView
.
When I scroll down, I can only see the text of the TextView
.
But not the image of the Imageview
.
Here is a part of my layout:
<RelativeLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_marginLeft="260dp"
android:layout_marginBottom="50dp"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text_handlungsleitfaden_strassenfuehrer"
android:layout_marginTop="10dp"
android:scrollbars="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/bild_handlungsleitfaden_strassenfuehrer"
android:layout_marginTop="10dp"
android:src="@drawable/maschine"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/handlungsleitfaden_btn"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:textAllCaps="false"
android:text="weiter" />
</RelativeLayout>
Does anybody have an idea how to fix it? :) Thank you
just provide orientation to linearLayout
, By default orientation is horizontal so you have to provide android:orientation="vertical"
like this :
<ScrollView
android:layout_marginLeft="260dp"
android:layout_marginBottom="50dp"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/text_handlungsleitfaden_strassenfuehrer"
android:layout_marginTop="10dp"
android:scrollbars="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/bild_handlungsleitfaden_strassenfuehrer"
android:layout_marginTop="10dp"
android:src="@drawable/maschine"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/handlungsleitfaden_btn"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="7dp"
android:textAllCaps="false"
android:text="weiter" />
</RelativeLayout>