Reputation: 13165
I am adding a scroll view for whole layout. Inside that layout I am adding a lot of view list view and fixed footer. My list view content is not displaying properly. Its height is very short. Without scroll view it appears correctly. Can anybody tell me what the problem is and how to resolve it? list view is loading dynamically. My xml file is given below:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView android:id="@+id/mainScrollView"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true" android:scrollbars="none" android:isScrollContainer="false">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mainLinear"
android:gravity="left" >
<ImageView android:src="@drawable/day2" android:gravity="center" android:id="@+id/imgDay" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<ImageView android:src="@drawable/meetingtimetable2" android:gravity="center" android:id="@+id/txtMeeting" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
<ImageView android:src="@drawable/eventschedule2" android:gravity="center" android:id="@+id/imgEvent" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/mainLinear"
android:background="@drawable/day3"
android:paddingTop="10dip"
android:id="@+id/commonLinear">
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/commonLayout"
layout="@layout/common"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chkLinear"
android:background="@drawable/meetingtimetable3"
android:layout_below="@+id/mainLinear"
android:layout_toRightOf="@+id/commonLinear"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subLinear"
android:layout_marginLeft="5dip"
android:paddingTop="10dip"
android:layout_marginBottom="5dip"
android:gravity="center" >
<Button android:background="@drawable/meetingrequestrecieved" android:layout_marginRight="5dip" android:gravity="left" android:id="@+id/btnMeetingRequest" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:background="@drawable/newmeeting" android:layout_width="wrap_content" android:gravity="left" android:layout_height="wrap_content" android:id="@+id/btnSendNewRequest"></Button>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listLinear"
android:layout_toRightOf="@+id/commonLinear"
android:layout_below="@+id/subLinear"
android:gravity="left"
android:paddingRight="5dip">
<ListView android:id="@+id/lstSendMeeting" android:scrollingCache="false" android:layout_width="300dip" android:layout_height="wrap_content"></ListView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<!-- footer -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/bottomLinear1">
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/commonLayout1"
layout="@layout/commonbottom"/>
</LinearLayout>
</RelativeLayout>
Thanks
Upvotes: 3
Views: 7546
Reputation: 3383
You can't add a ListView inside of ScrollView
Check this out How can I get my ListView to scroll?
But seems this guy made it work. Which is Great.
Upvotes: 4
Reputation: 143
It's because of android:layout_height="wrap_content" because you are setting the height of listview as wrap_content which results in the listview of smaller size. Increase the layout height or change it into fill_parent ,you will get the desired result
Upvotes: 0