2012-04-13 4 views
0

제 활동에서 5 개의 탭을 동적으로 생성합니다.내 탭의 내용이 전체 공간을 채우지 못합니다.

로딩 애니메이션이 전체 공간을 채우지 못하는 이유를 파악하려고합니다. 지금은 탭 내용 상단에있는 작은 사각형입니다 (http://imageshack.us/photo/my-images/594/loadingwf.png/ 참조).

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)); 
} 

그리고 여기에 애니메이션의 XML 파일입니다 :

<?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

나는 코드의이 부분이 정확하다고 생각 여기

내가 각 탭의 콘텐츠를 만드는 코드입니다. 액티비티 XML에는 무엇이 있습니까?

+0

안녕하세요. 먼저 시간 내 주셔서 감사합니다. 내 코드가 맞았 기 때문에 바보처럼 느껴진다 ... 문제는 액티비티 XML 레이아웃에 있었고, 단순히 wrap_content를 fill_parent로 바꿨다. – Fr4nz

관련 문제