- 浏览: 249168 次
- 性别:
- 来自: 深圳
-
文章分类
最新评论
-
江恂泽:
楼主 这家伙会把data 拆分开来 转换成day year形 ...
JsonUtil -
mdsp25xhm:
为何没有列表查询功能?
myBatis DAO封装
private TabHost tabHost;
private int[] layRes = { R.id.t_1, R.id.t_2 , R.id.t_3 };
@Override
protected void onCreate(Bundle instance)
{
super.onCreate(instance);
initResource();
}
/**
* 初始化资源
*
* @param
* @return void
* @throws
* @since TianTian
*/
private void initResource()
{
tabHost = super.getTabHost();
LayoutInflater.from(this).inflate(R.layout.thost, tabHost.getTabContentView(), true);
/*
* 循环取出所有布局标记
*/
for (int x = 0; x < this.layRes.length; x++)
{
TabSpec myTab = tabHost.newTabSpec("tab" + x); // 定义TabSpec
myTab.setIndicator("标签 - " + x); // 设置标签文字
myTab.setContent(this.layRes[x]); // 设置显示的组件
this.tabHost.addTab(myTab); // 增加标签
}
}
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/coral">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_1" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt5" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_2" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt6" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_3" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt7" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
private int[] layRes = { R.id.t_1, R.id.t_2 , R.id.t_3 };
@Override
protected void onCreate(Bundle instance)
{
super.onCreate(instance);
initResource();
}
/**
* 初始化资源
*
* @param
* @return void
* @throws
* @since TianTian
*/
private void initResource()
{
tabHost = super.getTabHost();
LayoutInflater.from(this).inflate(R.layout.thost, tabHost.getTabContentView(), true);
/*
* 循环取出所有布局标记
*/
for (int x = 0; x < this.layRes.length; x++)
{
TabSpec myTab = tabHost.newTabSpec("tab" + x); // 定义TabSpec
myTab.setIndicator("标签 - " + x); // 设置标签文字
myTab.setContent(this.layRes[x]); // 设置显示的组件
this.tabHost.addTab(myTab); // 增加标签
}
}
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/coral">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_1" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt5" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_2" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt6" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout android:layout_height="match_parent"
android:id="@+id/t_3" android:layout_width="wrap_content">
<ImageView android:layout_height="wrap_content"
android:src="@drawable/jt7" android:id="@+id/imageView1"
android:layout_width="wrap_content"></ImageView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
发表评论
-
IMF简介-2
2013-07-09 17:56 917InputManager 由UI控件(View,TextVie ... -
IMF简介-1
2013-07-09 17:51 828Input Method Framework 目录 ... -
输入法 总结-3
2013-07-08 15:02 863public class MainActivity exten ... -
输入法 总结-4
2013-07-04 17:29 946public class InputActivity exte ... -
输入法 总结-3
2013-07-04 17:28 868public class InputApplication e ... -
输入法 总结-2
2013-07-04 17:23 789openwnn_pref_ja.xml <?xml v ... -
输入法 总结-2
2013-07-04 17:21 13openwnn_pref_ja.xml <?xml v ... -
输入法 总结-1
2013-07-04 17:19 809<application android ... -
Android快捷键
2013-03-15 14:39 852Home键(小房子键) 在 ... -
如何通过wifi调试android程序
2013-02-27 15:48 782android手机居然可以通过wifi进行程序的调试,太好了, ... -
Please ensure that adb is correctly located at 'D:\android-sdk-windows\platform-
2013-02-27 14:27 1675adt 出现ADB server didn't ACK, fa ... -
Android AsyncTask
2013-02-19 09:35 1142AsyncTask是抽象类,子类 ... -
Android ViewPager 左右滑动2-1
2013-01-29 10:12 1525public class PagerActivity exte ... -
Android ViewPager 左右滑动-3
2013-01-29 10:10 1116<?xml version="1.0" ... -
Android ViewPager 左右滑动-2
2013-01-29 10:10 1494/*** * 选中效果 */ pu ... -
Android ViewPager 左右滑动-1
2013-01-29 10:09 1396Store extends ActivityGroup imp ... -
Android 下载
2013-01-27 00:59 927下载apk程序代码 protected File downLo ... -
Android SDCard操作-3
2013-01-26 18:31 896public static Intent getVid ... -
Android SDCard操作-2
2013-01-26 18:30 1134/** * 判断该应用在手机中的安装情况 ... -
Android SDCard操作-1
2013-01-26 18:27 1071private static int INSTALLED = ...
相关推荐
综上所述,`android Tabhost使用Demo`是一个帮助开发者学习和理解如何在Android应用中实现多Tab界面的实例。通过这个Demo,你可以了解到TabHost的基本用法,包括设置Tab、关联Activity、自定义Tab样式以及处理Tab...
### Android Tabhost 使用详解 #### 一、Tabhost 概述 在Android开发过程中,`Tabhost` 是一个非常实用的组件,它可以帮助开发者轻松地为应用创建标签式导航界面。这种方式不仅美观而且能有效提高用户体验。本文将...
androidTabhost的使用实例代码,仅供参考
本篇文章将详细介绍如何在Android项目中使用TabHost,以及它的工作原理。 首先,我们需要理解TabHost的基本结构。TabHost是一个容器,它包含两个主要组件:TabWidget和FrameLayout。TabWidget用于显示和管理各个...
在Android开发中,`TabHost` 是一个非常实用的组件,用于创建具有多个选项卡的应用界面。它允许开发者在一个活动中展示多个视图,并通过选项卡进行切换。下面我们将详细介绍如何使用 `TabHost`,包括布局的设置和...
### Android TabHost 动态增加与删除详解 #### 一、TabHost简介 ...以上就是在Android中使用TabHost实现动态增加和删除标签的方法。这种方法不仅可以提高应用的灵活性,还能让用户体验更加友好。
在Android应用开发中,TabHost是一个非常重要的组件,它用于创建多标签的界面,让用户能够通过...通过理解和实践这个示例,开发者可以更好地掌握Android TabHost的使用,以及如何在实际项目中灵活运用,提升用户体验。
在Android开发中,`TabHost`、`Spinner`和`ListView`是三个非常重要的组件,它们各自承担着不同的功能,并且可以协同工作以提供丰富的用户界面。`TabHost`用于创建多标签界面,`Spinner`则是一种下拉选择菜单,而`...
在Android开发中,TabHost组件是一个非常实用的控件,用于创建带有标签页的应用界面,让用户可以在多个功能之间轻松切换。本文将详细讲解如何使用TabHost,并通过实例代码进行演示。 首先,TabHost的核心组成部分...
本文将深入讲解如何在Android中使用TabHost,并通过一个简单实例来演示其基本用法。 首先,我们需要了解TabHost的基本结构。TabHost通常包含两个主要部分:TabWidget和FrameLayout。TabWidget负责显示和管理各个Tab...
android tabhost 动态添加 删除 排序 重命名
在Android开发中,TabHost是一个非常重要的组件,用于创建具有多个选项卡的用户界面,每个选项卡都可以展示不同的内容或活动。在这个特定的场景中,我们看到标题提及“android tabhost 日期”,这意味着开发者可能在...
android tabhost 动态添加,删除,排序,重命名
在Android应用开发中,TabHost是一个非常重要的组件,它允许我们创建带有多个选项卡的应用界面。这个组件在早期的Android版本中广泛使用,为用户提供了一种便捷的方式来组织和切换不同的视图或活动。本文将深入探讨...
Android 实现tab视图有2种方法,一种是在布局页面中定义<tabhost>标签,另一种就是继承tabactivity.但是我比较喜欢第二种方式,应为如果页面比较复杂的话你的XML文件会写得比较庞大,用第二种方式XML页面相对要简洁得...
在Android开发中,TabHost是一个非常重要的组件,用于创建具有多个Tab标签的界面,每个标签页可以关联一个单独的活动(Activity)或者帧布局(FrameLayout)。本实例演示了如何在Android应用程序中自定义TabHost,以...
- 考虑到兼容性和性能优化,对于Android API 11及以上版本,可以使用 `ActionBar` 或 `TabLayout` 替代 `TabHost`。 通过以上步骤,我们可以实现类似微信主界面的 `TabHost` 界面切换。在实际开发中,根据项目需求...
android TabHost分页 demo 一开始就能用
android tabhost 动态添加,删除,排序,重命名
在Android开发中,TabHost是实现底部导航菜单的一种传统方式,它允许用户在多个标签页之间切换,每个标签页通常代表一个不同的功能区域。本文将详细介绍如何使用TabHost来创建带有图片和文字,并且在选中时有明显...