android建立工程及使用Tabhost
来源:互联网 发布:中山大学远程网络教育 编辑:程序博客网 时间:2024/05/21 06:13
另外代码可参考:
http://zxl-ong.iteye.com/blog/744809
自己工程的代码及xml
activity_main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="fill_parent"><LinearLayout android:id="@+id/widget_layout_Blue"android:layout_width="fill_parent" android:layout_height="fill_parent"android:orientation="vertical" ><EditText android:id="@+id/widget34" android:layout_width="fill_parent"android:layout_height="wrap_content" android:text="EditText"android:textSize="18sp"></EditText><Button android:id="@+id/widget30" android:layout_width="wrap_content"android:layout_height="wrap_content" android:text="Button"></Button></LinearLayout><LinearLayout android:id="@+id/widget_layout_red"android:layout_width="fill_parent" android:layout_height="fill_parent"android:orientation="vertical" ><AnalogClock android:id="@+id/widget36"android:layout_width="wrap_content" android:layout_height="wrap_content"></AnalogClock></LinearLayout><LinearLayout android:id="@+id/widget_layout_green"android:layout_width="fill_parent" android:layout_height="fill_parent"android:orientation="vertical"><RadioGroup android:id="@+id/widget43"android:layout_width="166px" android:layout_height="98px"android:orientation="vertical"><RadioButton android:id="@+id/widget44"android:layout_width="wrap_content" android:layout_height="wrap_content"android:text="RadioButton"></RadioButton><RadioButton android:id="@+id/widget45"android:layout_width="wrap_content" android:layout_height="wrap_content"android:text="RadioButton"></RadioButton></RadioGroup></LinearLayout></FrameLayout>
MainActivity
package com.android.mytabhost;import android.app.TabActivity;import android.graphics.Color;import android.os.Bundle;import android.view.LayoutInflater;import android.widget.TabHost;public class MainActivity extends TabActivity {TabHost myTabhost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);myTabhost=this.getTabHost();//get TabhostLayoutInflater.from(this).inflate(R.layout.activity_main, myTabhost.getTabContentView(), true);myTabhost.setBackgroundColor(Color.argb(150, 22, 70, 150));myTabhost.addTab(myTabhost.newTabSpec("One")// make a new Tab.setIndicator("A")// set the Title and Icon.setContent(R.id.widget_layout_Blue));// set the layoutmyTabhost.addTab(myTabhost.newTabSpec("Two")// make a new Tab.setIndicator("B")// set the Title and Icon.setContent(R.id.widget_layout_green));// set the layoutmyTabhost.addTab(myTabhost.newTabSpec("Three")// make a new Tab.setIndicator("C")// set the Title and Icon.setContent(R.id.widget_layout_red)); }}
0 0
- android建立工程及使用Tabhost
- crosswalk工程建立及使用
- Android中TabHost的原理及使用
- 【TabHost】Android设置TabHost文字及图片
- tabhost简单使用及tabhost源码分析
- tabhost简单使用及tabhost源码分析
- Android TabHost的使用
- Android TabHost的使用
- android tabHost使用
- Android TabHost的使用
- android TabHost 使用
- Android TabHost的使用
- android Tabhost的使用
- android:tabhost 使用
- Android TabHost的使用 .
- android TabHost 使用
- Android TabHost的使用
- Android TabHost的使用
- Linux性能统计 - free
- spring中bean初始化过程
- quick 2.23 自定义c++代码给lua用的一些细节总结
- JavaScript应用核心:事件处理概述
- 创建和管理Excel控件Aspose.Cells
- android建立工程及使用Tabhost
- android 发送UDP广播,搜寻服务器建立socket链接
- Spring3.1 Cache注解
- 杭电1002 A+B problem II
- 辛勤打手,快捷鳄鱼肉傲丝度官方爱上鱼儿
- 关于activiti驳回等功能的封装
- 分离表达式中的数字和运算符
- C语言文件操作函数
- 转载:硬盘的读写原理