`

简单的程序底部Tab例子

阅读更多
1.建立Tab的简单例子:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal" android:layout_width="fill_parent"
	android:layout_height="wrap_content">
	<LinearLayout android:orientation="vertical"
		android:layout_width="80px" android:layout_height="wrap_content"
		android:id="@+id/home" android:background="@drawable/tab_one_normal">
		<TextView android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/home"
			android:background="@drawable/home" style="@style/SpecialText" />
	</LinearLayout>
	<ImageView android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:src="@drawable/line" />
	<LinearLayout android:orientation="vertical"
		android:layout_width="80px" android:layout_height="wrap_content"
		android:background="@drawable/tab_one_normal" android:id="@+id/publish">
		<TextView android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/publish"
			style="@style/SpecialText" android:background="@drawable/publish" />
	</LinearLayout>
	<ImageView android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:src="@drawable/line" />
	<LinearLayout android:orientation="vertical"
		android:layout_width="80px" android:id="@+id/change"
		android:layout_height="wrap_content" android:background="@drawable/tab_one_normal">
		<TextView android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/change"
			style="@style/SpecialText" android:background="@drawable/change" />
	</LinearLayout>
	<ImageView android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:src="@drawable/line" />
	<LinearLayout android:orientation="vertical"
		android:layout_width="80px" android:id="@+id/more"
		android:layout_height="wrap_content" android:background="@drawable/tab_one_normal">
		<TextView android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/more"
			style="@style/SpecialText" android:background="@drawable/more" />
	</LinearLayout>

</LinearLayout>




2.java代码段:
		linearLayout = (LinearLayout) findViewById(R.id.home);
		linearLayout.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				linearLayout
						.setBackgroundResource(R.drawable.tab_two_highlight);
				publish.setBackgroundResource(R.drawable.tab_one_normal);
				change.setBackgroundResource(R.drawable.tab_one_normal);
				more.setBackgroundResource(R.drawable.tab_one_normal);
			}
		});




3.另外附上部分图片资源,个人觉得做Tab只要资源有就可以做的很好
分享到:
评论
1 楼 lufengdie 2010-09-28  

你真搞笑·

相关推荐

    微信小程序官方动态自定义底部tabBar的例子

    微信小程序官方动态自定义底部tabBar是一种实现动态切换底部导航菜单的方式,它可以根据用户的实际需求,实现更加灵活和个性化的底部tabBar展示效果。本文将详细介绍微信小程序官方提供的动态自定义底部tabBar的实现...

    底部tab(RadioButton+fragment)

    底部Tab栏在移动应用设计中是非常常见的元素,它通常由几个RadioButton组成,用于在不同的功能模块之间进行切换。在这个场景中,我们使用RadioButton与Fragment相结合,实现了一个动态切换内容的底部导航栏。以下是...

    微信小程序底部tabbar图片

    微信小程序底部tabbar是用户界面(UI)设计中的一个重要元素,它位于小程序界面的最下方,通常包含两到五个图标,用于快速切换不同的页面或功能模块。这些图标和相应的文字标签为用户提供了一种直观的导航方式,使得...

    tab控件使用小例子

    3. **TCS_* 样式**: Tab控件可以有多种样式,如TCS_BOTTOM(底部显示Tab页)、TCS_MULTILINE(多行显示)等。通过在CreateWindowEx中传递这些样式,我们可以自定义Tab控件的外观。 4. **TCM_ADJUSTRECT** 和 **TCM_...

    Tab分页式菜单

    在IT界,Tab分页式菜单是一种常见的用户界面(UI)设计模式,广泛应用于各种应用程序和网站中。这种设计模式允许用户通过点击不同的标签在多个视图之间切换,以查看和操作不同类别的内容,而无需打开多个独立的窗口...

    安卓FragmentTab选项卡相关-Android仿百度贴吧看帖滑动返回效果.rar

    9. **IntentDemo**:Intent在Android中是应用程序之间通信的重要手段。IntentDemo可能是演示如何使用Intent在不同的Fragment或Activity之间传递数据的示例。 10. 图片资源:134848d9afz5u59sael9p9.png可能是应用...

    微信小程序学习demo:娱票:tab切换

    在微信小程序中,TabBar是底部导航栏,通常用于展示应用的主要功能模块。娱票小程序的TabBar可能包括“电影”、“演出”、“我的”等页面,用户可以通过点击TabBar进行页面间的切换,提供良好的用户体验。 学习这个...

    小程序根据手机机型设置自定义底部导航距离

    在开发微信小程序时,经常会遇到需要针对不同手机机型进行适配的情况,特别是在处理底部导航栏时。本案例中,需求是针对iPhone X及以上机型,由于这些设备的屏幕底部有较大的弧度,导致自定义的导航栏可能会被遮挡。...

    scroll-view-tab联动.zip

    在移动端开发中,`tab` 通常位于页面顶部或底部,用于展示多个页面间的导航。`tab` 的设计应遵循易用性原则,如清晰的标签文字、明显的选中状态以及合理的触摸面积。 3. **联动原理**:`scroll-view` 和 `tab` 的...

    使用 RadioGroup和TabHost 实现底部菜单栏

    在这个例子中,`Tab1Activity`和`Tab2Activity`分别代表底部菜单栏的两个页面。当用户点击`RadioButton`时,`TabHost`会根据所选的标签加载相应的活动。 为了使`RadioButton`与`TabHost`联动,我们需要监听`...

    java选项卡小例子

    Java选项卡小例子是针对Java Swing库中的JTabbedPane组件的一个简单应用实例。在Java GUI编程中,JTabbedPane是一个非常实用的控件,它允许我们创建带有多个面板的界面,每个面板都可以作为单独的“选项卡”,用户...

    reactnative底部导航栏

    `react-navigation`是一个强大的路由和导航解决方案,它为React Native应用程序提供了多种导航方案,包括栈导航、抽屉导航以及我们关注的底部标签导航。 创建一个底部导航栏,首先需要安装`react-navigation`及其...

    Ionic创建页面以及页面之间跳转、页面添加返回按钮、新增底部页面示例代码.zip

    在本文中,我们将深入探讨如何使用Ionic框架创建页面、实现页面间的跳转,以及...通过理解和掌握页面创建、导航控制、以及UI元素如返回按钮和底部导航的使用,你将能更好地利用Ionic来开发高效且用户友好的应用程序。

    sencha touch 例子 Tabs 和 Toolbars 使用

    Sencha Touch 是一款专为移动设备设计的JavaScript框架,用于构建高性能的触控Web应用程序。这个框架提供了丰富的组件和API,使得开发者可以轻松地创建出与原生应用体验相媲美的移动应用。在这个"sencha touch 例子 ...

    sencha touch app框架nav+tab和nav+menu

    Sencha Touch是一款强大的JavaScript框架,专门用于构建移动Web应用程序。它提供了一整套组件和工具,使得开发者能够创建具有原生应用体验的交互式触控界面。本资源包含两个示例,分别是基于“nav+tab”和“nav+menu...

    BottomBar小例子

    BottomBar是Android开发中一种常见的底部导航栏组件,它用于在多个主要功能间进行切换,类似于许多移动应用底部固定的Tab栏。在这个“BottomBar小例子”中,我们将深入探讨如何在Android项目中实现和自定义BottomBar...

    多文档的Tabview示例

    6. **自定义样式和行为**:根据需求,可能需要调整Tab控件的外观,例如设置Tab位置(顶部、底部、左侧、右侧)、间距、字体样式等,并实现特定的用户交互效果,如拖放Tab页。 7. **测试和优化**:完成基本功能后,...

    IOS应用源码——很炫的底部导航.zip

    这个"很炫的底部导航"的源码提供了一个实现这种功能的例子,对于iOS开发者来说,是学习和理解如何创建自定义底部导航栏的一个很好的资源。以下是基于这个主题的详细知识点: 1. **UIKit框架**:iOS中的UI设计主要...

Global site tag (gtag.js) - Google Analytics