I have a LinearLayout used by my Main Activity that looks as follows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/activity_main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
I am dynamically adding fragments inside activity_main_container but the problem is, when my fragment height is larger than the screen height, the content at the bottom gets hidden. I am not able to scroll or do anything.
I have tried wrapping the fragment's layout inside ScrollView but it won't work for me because I have listview inside my fragments. I've also tried setting layout height to say 3000dp on every container but it didn't work either.
My fragment's sample layout that I am dynamically adding looks as follows. I am adding contents dynamically inside my fragment as well.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_listing_detail_linearLayout_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:orientation="vertical"
android:paddingLeft="@dimen/fragment_padding_side"
android:paddingRight="@dimen/fragment_padding_side" >
<TextView
android:id="@+id/fragment_listing_detail_textview_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Review Title"
android:textSize="20sp"
android:textStyle="bold" />
<RatingBar
android:id="@+id/fragment_listing_detail_ratingbar_rating"
style="@style/customRatingBarSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="0.5"
android:isIndicator="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Photos" />
<View style="@style/divider" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp" >
<LinearLayout
android:id="@+id/fragment_listing_detail_linearlayout_images"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="@+id/fragment_listing_detail_textview_review"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Reviews" />
<View style="@style/divider" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:paddingTop ="7dp"
android:paddingBottom="7dp"
android:layout_height="wrap_content"
android:contentDescription="review divisor"
android:src="@android:drawable/divider_horizontal_bright" />
</LinearLayout>
<LinearLayout
android:id="@+id/fragment_listing_detail_reviews_fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<Button
android:id="@+id/fragment_listing_detail_button_add_review"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Review" />
<ImageView
android:id="@+id/fragment_listing_detail_imageview_testimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
How do I make it so that when my fragment goes beyond screen height, I can still scroll to see the bottom views? Thanks.