Parveen Sharma
Parveen Sharma

Reputation: 113

Relative Layout inside ScrollView not working...!

This is my abc.xml in which I'm using the relative layout as a parent layout inside ScrollView, I've used fillviewport and scrollbar parameters many times but it's not working...

<ScrollView
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fillViewport="true"
  android:scrollbars="none">

  <RelativeLayout
    android:id="@+id/SU_user_detail_parent_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/custom_background">

  <More Components here..../>

</RelativeLayout>
</ScrollView>

This is how I'm implementing this...

     AlertDialog.Builder alertBuilder = new AlertDialog.Builder(SelectorActivity.this);

     View view = LayoutInflater.from(SelectorActivity.this).inflate(R.layout.abc, null);

     alertBuilder.setView(view);
     AlertDialog d = alertBuilder.create();

     d.show();

Upvotes: 0

Views: 595

Answers (1)

Sasi Kumar
Sasi Kumar

Reputation: 13288

Add LinearLayout inside scrollview and put in Relative layout inside of Linearlayout.

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/SU_user_detail_parent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_background">

<More Components here..../>

</RelativeLayout>
</LinearLayout>
</ScrollView>

Upvotes: 2

Related Questions