The content of my tabs doesn't fill the whole space

不羁的心 提交于 2020-01-07 02:49:08

问题


In my activity I create 5 tabs dynamically.

I'm trying to figure out why my loading animation doesn't fill the whole space. Right now it's only a small rectangle in the top of the tab content (see http://imageshack.us/photo/my-images/594/loadingwf.png/).

Here is the code where I create the content of each tab :

for (int i = 0; i < NewsCategory.values().length; i++) {
    View tabView = createTabView(tabHost.getContext(), NewsCategory.getValueAt(i).getName());

    tabNewslist[i] = new Newslist(this, NewsCategory.getValueAt(i));
    getLayoutInflater().inflate(R.layout.loading_anim, tabHost.getTabContentView(), true);
    tabHost.addTab(tabHost.newTabSpec(NewsCategory.getValueAt(i).getName()).setIndicator(tabView).setContent(R.id.loadingAnim));
}

And here is the XML file of the animation :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/loadingAnim"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:gravity="center_horizontal"
    android:orientation="horizontal"
    android:padding="5dp" >

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="@string/loading" />

</LinearLayout>

回答1:


I think this part of code is correct. What do you have in your activity xml?



来源:https://stackoverflow.com/questions/10140542/the-content-of-my-tabs-doesnt-fill-the-whole-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!