我的选项卡的内容不填满了整个空间 [英] The content of my tabs doesn't fill the whole space
本文介绍了我的选项卡的内容不填满了整个空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的活动我创建5个标签页动态。
我试图找出为什么我的加载动画没有填满整个空间。现在它只是在标签内容的顶部(一个小矩形见 HTTP: //imageshack.us/photo/my-images/594/loadingwf.png/ )。
下面是code,我创建的每个选项卡的内容:
的for(int i = 0; I< NewsCategory.values()长;我++){
视图TabView的= createTabView(tabHost.getContext(),NewsCategory.getValueAt(ⅰ).getName()); tabNewslist [I] =新新闻列表(此,NewsCategory.getValueAt(ⅰ));
。getLayoutInflater()膨胀(R.layout.loading_anim,tabHost.getTabContentView(),TRUE);
tabHost.addTab(tabHost.newTabSpec(NewsCategory.getValueAt(i).getName()).setIndicator(tabView).setContent(R.id.loadingAnim));
}
这里是动画的XML文件:
<?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:ID =@ + ID / loadingAnim
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:背景=#FFFFFF
机器人:重力=CENTER_HORIZONTAL
机器人:方向=横向
机器人:填充=5DP> <进度
机器人:ID =@ + ID /进度
风格=机器人:ATTR / progressBarStyleSmall
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical
机器人:文字=@字符串/装载/>< / LinearLayout中>
解决方案
我觉得code,这部分是正确的。
你在你的XML的活动有哪些?
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>
解决方案
I think this part of code is correct. What do you have in your activity xml?
这篇关于我的选项卡的内容不填满了整个空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文