Reputation: 487
basically i'm creating a profile for a user which can have his education and experience as well. these values can be multiple so i have used list views for them enclosed them in relative layout and then in scroll view. the problem is when total size increases full screen size scroll view height does not increase.
here is my xml code. and for the height of list views i'm increasing height of their respective relative layout that is working fine but problem is with scrollview
Code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="false" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/profile_main_r"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/image_bg" >
<ImageButton
android:id="@+id/profile_list_button"
android:layout_width="27dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="6dp"
android:background="@android:color/transparent"
android:contentDescription="@string/profile_edit_buttons"
android:src="@drawable/ic_edit"
android:visibility="gone" />
<ListView
android:id="@+id/profile_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:listSelector="@android:color/transparent"
android:longClickable="false"
android:orientation="horizontal" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/profile_experience_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profile_main_r"
android:layout_marginTop="8dp"
android:background="@drawable/image_bg"
android:cacheColorHint="@android:color/transparent"
android:listSelector="@android:color/transparent"
android:padding="6dp" >
<ImageView
android:id="@+id/profile_exp_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:contentDescription="@string/drawer_user_img"
android:src="@drawable/ic_experience" />
<TextView
android:id="@+id/exp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/profile_exp_icon"
android:padding="3dp"
android:text="@string/experience"
android:textColor="@color/dodger_blue"
android:textSize="15sp"
android:textStyle="normal"
android:typeface="sans" />
<ImageButton
android:id="@+id/profile_experience_button"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:contentDescription="@string/profile_edit_buttons"
android:src="@drawable/ic_add"
android:visibility="gone" />
<ListView
android:id="@+id/profile_experience_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/profile_exp_icon"
android:layout_marginTop="4dp"
android:cacheColorHint="@android:color/transparent"
android:clickable="false"
android:divider="@android:color/transparent"
android:dividerHeight="8dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:listSelector="@android:color/transparent"
android:longClickable="false"
android:padding="5dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/profile_education_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profile_experience_main"
android:layout_marginTop="8dp"
android:background="@drawable/image_bg"
android:cacheColorHint="@android:color/transparent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:listSelector="@android:color/transparent"
android:longClickable="false"
android:padding="6dp" >
<ImageView
android:id="@+id/profile_edu_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:contentDescription="@string/drawer_user_img"
android:src="@drawable/ic_education" />
<TextView
android:id="@+id/profile_education_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/profile_edu_icon"
android:padding="4dp"
android:text="@string/education"
android:textColor="@color/dodger_blue"
android:textSize="15sp"
android:textStyle="normal"
android:typeface="sans" />
<ImageButton
android:id="@+id/profile_education_button"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:contentDescription="@string/profile_edit_buttons"
android:src="@drawable/ic_add"
android:visibility="gone" />
<ListView
android:id="@+id/profile_education_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/profile_edu_icon"
android:layout_marginTop="2dp"
android:cacheColorHint="@android:color/transparent"
android:clickable="false"
android:divider="@android:color/transparent"
android:dividerHeight="8dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:listSelector="@android:color/transparent"
android:longClickable="false"
android:padding="5dp"
android:paddingLeft="2dp" />
</RelativeLayout>
<Button
android:id="@+id/project_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profile_education_main"
android:layout_marginTop="5dp"
android:background="@drawable/button_design"
android:text="@string/view_projects"
android:textColor="@color/white" />
</RelativeLayout>
Upvotes: 0
Views: 76
Reputation: 33
You cant use ListView inside scroll view because listview already contains a scrollview.
Upvotes: 1