解决方案 »
- 为什么看不到设计界面?
- android自动签名问题!!!!
- GestureDetector 的问题,各位帮忙看看
- android 可执行文件怎么集成到系统中?
- 急急急急急急急急急!~android模拟器打不开啊!快崩溃了!
- android 找错
- android ListView 添加数据总是覆盖掉上一行,并只显示一行
- android 加载网络图片资源出现异常
- Fragment内改变ActionBar的内容
- Android怎么设置sd卡的保存目录啊?
- 虚拟按键---制作一个按钮,按下去后显示菜单。
- java.lang.SecurityException: No active admin owned by uid 10034 for policy #3
android:id="@+id/prize_tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" > </android.support.v4.app.FragmentTabHost>再在fragment中
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frg_prize, container, false);
mTabHost = (FragmentTabHost) view.findViewById(R.id.prize_tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.prize_title);
mTabHost.addTab(mTabHost.newTabSpec(“tag”).setIndicator(“NAME”),
fragment, null);
mTabHost.addTab(mTabHost.newTabSpec(“tag1”).setIndicator(“NAME1”),
fragment, null);
}
R.id.prize_title是所在布局中的一项。
没发现异常呢?
或者你把代码贴一下,才能看错误。
http://download.csdn.net/detail/gluoyer/5226669
TabHost host = (TabHost) findViewById(R.id.tabhost);
host.setup(); TabHost.TabSpec homeSpec = host.newTabSpec("Home"); // This param will
// be used as tabId.
homeSpec.setIndicator(null, // This param will diplay as title.
getResources().getDrawable(R.drawable.home));
homeSpec.setContent(R.id.tab1);
host.addTab(homeSpec); TabHost.TabSpec garbageSpec = host.newTabSpec("Garbage");
garbageSpec.setIndicator(null, getResources().getDrawable(R.drawable.garbage));
garbageSpec.setContent(R.id.tab2);
host.addTab(garbageSpec); TabHost.TabSpec maybeSpec = host.newTabSpec("Help");
maybeSpec.setIndicator(null, getResources().getDrawable(R.drawable.help));
maybeSpec.setContent(R.id.tab3);
host.addTab(maybeSpec); host.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
Toast toast = Toast.makeText(MainActivity.this, tabId, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 50);
toast.show();
}
});
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" > <TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget> <FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" > <LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:orientation="horizontal" > <TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="@string/image_name"
android:textSize="16sp"
android:textStyle="bold" /> <TextView
android:layout_width="1000dp"
android:layout_height="wrap_content"
android:text="@string/image_url"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout> <ListView
android:id="@+id/list1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:footerDividersEnabled="true"
android:headerDividersEnabled="true" >
</ListView>
<!-- <ImageView -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_gravity="center" -->
<!-- android:src="@drawable/home" /> -->
</LinearLayout> <LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
android:orientation="vertical" > <ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:contentDescription="@string/image_desc"
android:src="@drawable/garbage" />
</LinearLayout> <LinearLayout
android:id="@+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
android:orientation="vertical" > <ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:contentDescription="@string/image_desc"
android:src="@drawable/help" />
</LinearLayout>
</FrameLayout></TabHost>其中,注意
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>这里的id必须是这个名字~
Exception details are logged in Window > Show View > Error Log
解决了没 帖子都一年了 求教
试试QT/QML吧。java写界面简直欲哭无泪。