I'm trying to use the layout_weight attribute for testing. It works fine excpect for the ListView. I've set the height to 0dp and the weightsum. I've tried to put the ListView into a relative Layout but I get the same result.
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:text="TextView" />
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25" >
</ListView>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:text="TextView" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:text="Button" />
</LinearLayout>
And this is how it looks:
It seems connected to the theme I'm using. I'm using Theme.Black.NoTitleBar
Theme. The weird thing is I can see it normal in the emulator but not in the IDE, but I need to see things in the IDE, because I work a lot with the GUI and I'm rarly coding in XML. Is there a fix for this? Is this a known bug?
You can change the Theme of the IDE in the right top border. It may be that the current theme chosen miss some attrs.