0

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>
Fr4nz
  • 1,616
  • 6
  • 24
  • 33

1 Answers1

1

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

cyria
  • 26
  • 1
  • 2
  • Hi, first of all thank's for your time. I feel like an idiot right know because you were right my code is correct... The problem was in the activity XML layout, I simply changed wrap_content to fill_parent and it worked ! – Fr4nz Apr 13 '12 at 18:26