I have implemented a ListView
in an Activity
. I am having issue with layout. I have a TextView
in the Activity
and then, below to it, I need to display the ListView
items. Both are filling correctly, but the first ListView
item overlaps the TextView
layout, and hence the TextView
text and first ListView
item text appear in the same line. I am putting the layout text below. Please let me know what layout property I am missing and should use to correct the issue.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.rrd.school.project.AllClasses" >
<TextView
android:id="@+id/allclassess_institutename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:visibility="visible"
android:textSize="10pt"
android:textColor="#0404B4"
android:background="#DF3A01"
/>
<ListView
android:id="@+id/classlistview"
android:layout_below="@+id/allclassess_institutename"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
</RelativeLayout>
listviewitem.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.rrd.school.project.ClassListItme" >
<TextView
android:id="@+id/classid"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:visibility="gone"
/>
<TextView
android:id="@+id/classname"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:visibility="visible"
android:textSize="8pt"
android:textColor="#0404B4"
/>
</RelativeLayout>