FragmentTabHost
来源:互联网 发布:快枪手炒股软件 编辑:程序博客网 时间:2024/06/11 20:46
xml布局文件:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <FrameLayout android:id="@+id/realtabcontent" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1"/> <android.support.v4.app.FragmentTabHost android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabhost" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" /> </android.support.v4.app.FragmentTabHost></LinearLayout>
代码:
FragmentTabHost tabHost= (FragmentTabHost) findViewById(android.R.id.tabhost);//找到fragmentTabHost tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);//setup for (int i=0;i<list.length;i++) { TabHost.TabSpec tabSpec =tabHost.newTabSpec("aa"+i+"bb").setIndicator(getview(i)); tabHost.addTab(tabSpec,list[i], null);//addtab }//获得tab布局
public View getview(int i){ View view = layoutInflater.inflate(R.layout.home_item, null); TextView textView = (TextView) view.findViewById(R.id.home_item_tv); textView.setText("aa"); return view;}
0 0
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabHost
- FragmentTabhost
- FragmentTabHost
- 【FragmentTabHost】FragmentTabHost的使用
- FragmentTabHost简介
- FragmentTabHost用法
- Android FragmentTabHost
- android fragmenttabhost
- FragmentTabHost 使用;
- FFTW使用说明及实例调用
- 软工视频
- 玩转Java注释:自动调用监听器
- HTML5快速入门(三)—— 标签综合运用
- [**** _firstBaselineOffsetFromTop] **1683
- FragmentTabHost
- Spring3.1 对Bean Validation规范的新支持(方法级别验证)
- Redis学习笔记9--Redis持久化
- dubbo性能测试报告
- JSONObject 和JSONArray的结合使用
- 在计算机尤其是人工智能领域,为何顶级会议尤为重要
- UI控件之ToggleButton(开关按钮)和Switch(开关)
- WebSocket 和socket 的区别
- android自定义View全解