0

List Fragment height is not working properly, it only shows 1st row of list, other rows of list dont show. I used wrap content for height but not working. If i run Fragment directly it shows all rows but if i add fragment in my main activity its show single row. Other rows show if i change height of fragment manually like layout_height="100dp";. I want fragment height to be dynamic. This my main activity xml code:

<android.support.v4.widget.NestedScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:showIn="@layout/app_bar_welcome" android:layout_width="match_parent"
        android:layout_height="match_parent"> 
        <fragment
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:name="com.app.Fragments.SpecialListFragment"
                    android:id="@+id/fragment3"
                    tools:layout="@layout/fragment_special_list" />

       <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#efefef"/> </android.support.v4.widget.NestedScrollView>

If i change height of fragment to 100dp than this happens: http://i.stack.imgur.com/atZZt.png
If i wrap content fragment: http://i.stack.imgur.com/7h120.png

Edited by peter_budo: Code formatting

2
Contributors
1
Reply
13
Views
2 Years
Discussion Span
Last Post by peter_budo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.