I’m going crazy trying to make an relative layout work. I was getting an problem with ListView, the listView always show an empty space with approximately, twice the height of one listView element, independent if the list is big enough to scroll or not (usually the list accommodate 4 elements without the need of scroll).
To solve that, I’m trying to implement an RelativeLayout. I have One TextView at the top, and one at the bottom, and my listview is in the middle. The textView’s must be “glued” on my listview, I was using LinearLayout before the empty space problem, and now I have this Relative Layout:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/background"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="fill_parent">
...
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+datatrade/tv_itens"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Itens:" />
<TextView
android:id="@+datatrade/tv_value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Value:" />
<ListView android:layout_width="fill_parent"
android:layout_height="200px"
android:layout_below="@datatrade/tv_itens"
android:layout_above="@datatrade/tv_value"
android:id="@+id/list_product"
/>
</RelativeLayout>
...
The problem is, that I just get my second text view shown, with “values: “, and nothing else!
All the rest of the relative layout is just ignored by android!
Does anyone know what can be the problem?
you have not declared where this textview should be displayed.