开发者

fill_parent with ListFragement

I am having problems getting my ListFragment to fill the screen vertically. It fills fine while the data is loading but but once I call setListShown(true) it shrinks to wrap_content. I changed the background of fragmentContainer and verified that it is shrinking also. I'm developing on a phone in 2.3.3.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    FragmentManager fragmentManager = getSupportFr开发者_运维知识库agmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    if(savedInstanceState == null){
            Queues qs = new Queues();
            fragmentTransaction.add(R.id.fragmentContainer, qs);
            fragmentTransaction.commit();
    }
}

<LinearLayout android:id="@+id/fragmentContainer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

edit: Here's the full layout code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout android:id="@+id/queueHeader"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:background="@drawable/header_gradient"
        android:gravity="center" >
        <TextView android:id="@+id/queueHeaderText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:textSize="14pt"
            android:text="Queues" />
    </LinearLayout>
    <ImageView
        android:layout_width="48dip"
        android:layout_height="48dip"
        android:layout_marginTop="-50dip"
        android:layout_marginLeft="8dip"
        android:src="@drawable/inin48" />
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#CCFFFFFF" >
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_weight="1" >
            <ImageView android:id="@+id/navCallback"
                android:layout_width="32dip"
                android:layout_height="32dip"
                android:layout_margin="6dip"
                android:src="@drawable/phone32" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#FF000000"
                android:text="Callbacks" />
        </LinearLayout>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_weight="1" >
            <ImageView android:id="@+id/navNews"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="6dip"
                android:src="@drawable/news32" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#FF000000"
                android:text="News" />
        </LinearLayout>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_weight="1" >
            <ImageView android:id="@+id/navAbout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="6dip"
                android:src="@drawable/about32" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#FF000000"
                android:text="About" />
        </LinearLayout>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:layout_weight="1" >
            <ImageView android:id="@+id/navSettings"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="6dip"
                android:src="@drawable/settings32" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#FF000000"
                android:text="Settings" />
        </LinearLayout>
    </LinearLayout>
    <FrameLayout android:id="@+id/fragmentContainer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</LinearLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜