I'm trying to have an alternating text and image in my scrollview. There are no errors on the code, however when I try to run the application. Its force closing. I'm new to android studio. How can I fix this? I tried to search answers here but I cant seem to find the solution that I'm looking for.
Here is my code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity ="center"
android:fillViewport="true"
android:layout_alignParentStart="true"
android:layout_marginTop="0dp"
android:id="@+id/scrollView">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#000"
android:textColorLink="@android:color/black"
android:textSize="18sp"
android:text="hello"/>
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/cheese_1"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#000"
android:textColorLink="@android:color/black"
android:textSize="18sp"
android:text="hi" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/cheese_2"/>
</ScrollView>
</LinearLayout>
Now it work
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity ="center"
android:fillViewport="true"
android:layout_alignParentStart="true"
android:layout_marginTop="0dp"
android:id="@+id/scrollView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#000"
android:textColorLink="@android:color/black"
android:textSize="18sp"
android:text="hello"/>
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/cheese_1"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#000"
android:textColorLink="@android:color/black"
android:textSize="18sp"
android:text="hi"/>
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/cheese_2"/>
</LinearLayout>
</ScrollView>
</LinearLayout>