登录
首页 » Android » Android TabHost嵌套用法示例

Android TabHost嵌套用法示例

于 2022-12-13 发布 文件大小:126.18 kB
0 150
下载积分: 2 下载次数: 1

代码说明:

本源代码演示Android TabHost组件嵌套的用法示例,屏幕上部和底部均出现TAb,下部的TAB是在上部指定TAB激活时才显示,实现了双层嵌套的TAB视图效果。本例子继承了TabActivity,注意:在设置双层嵌套时,要注意其TAB的顺序,若错乱可能会导致嵌套失败。   对于TabHost、布局文件中必须包含TabHost、TabWidget 、FrameLayout ,如果继承TabActivity,并且通过getTabHost()方法来获取TabHost,那么三者的ID必须是android.R.id.tabhost、android.R.id.tabs、android.R.id.tabcontent,如果继承Activity,可以通过findViewById来获取这三个组件,此时ID可自定义。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android通用开发UI框架(选项卡)
        是一个非常简单,快捷的选项卡框架
    2015-06-23下载
    积分:1
  • android 多线程实例源码下载
    android 多线程实例源码下载
    2015-05-13下载
    积分:1
  • android menu菜单的 入门实例 附源码 有截图
    适合新手学习的 android menu实例 详见截图
    2013-03-26下载
    积分:1
  • 简单的android闹钟源代码
    简单的android闹钟源代码,可实现安卓端闹钟的简单功能,设置提醒时间,提醒的周期,提醒的音乐等等,简单的android闹钟源代码,可实现安卓端闹钟的简单功能,设置提醒时间,提醒的周期,提醒的音乐等等,简单的android闹钟源代码,可实现安卓端闹钟的简单功能,设置提醒时间,提醒的周期,提醒的音乐等等
    2022-02-12 04:39:41下载
    积分:1
  • android (天气预报)
    该源码是一款天气预报应用,采用了调用当前城市以及时间
    2023-05-27 21:10:03下载
    积分:1
  • 自定义标签
    自定义标签
    2013-12-06下载
    积分:1
  • MyPiano
    一个实现钢琴功能的简单小安卓程序,里面可以学到播放声音,以及按键的动起来(The Andrews program a simple piano function, which you can learn to play a sound, as well as key move)
    2012-08-25 10:18:02下载
    积分:1
  • android 通过jdts.jar 连接SQLSEVER2008 实例源码下载
    android 通过jdts.jar 连接SQLSEVER2008 实例源码下载
    2014-09-08下载
    积分:1
  • PlaneGame
    java实现的android版飞机游戏,主要有surfaceView、mediaPlayer、MVC等的运用(java implementation plane game android version, mainly surfaceView, mediaPlayer, MVC, etc. use)
    2013-07-11 17:43:08下载
    积分:1
  • android open gl 示例代码下载
    [实例简介]Open GL 入门级示例 [实例截图] [核心代码]package com.china.gltry;import javax.microedition.khronos.egl.EGL10;import javax.microedition.khronos.egl.EGL11;import javax.microedition.khronos.egl.EGLConfig;import javax.microedition.khronos.egl.EGLContext;import javax.microedition.khronos.egl.EGLDisplay;import javax.microedition.khronos.egl.EGLSurface;import javax.microedition.khronos.opengles.GL;import android.view.SurfaceHolder;/** * An EGL helper class. */public class EGLHelper{ public EGLHelper() { } /** * Initialize EGL for a given configuration spec. * @param configSpec */ public void start(int[] configSpec){ /* * Get an EGL instance */ mEgl = (EGL10) EGLContext.getEGL(); /* * Get to the default display. */ mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); /* * We can now initialize EGL for that display */ int[] version = new int[2]; mEgl.eglInitialize(mEglDisplay, version); EGLConfig[] configs = new EGLConfig[1]; int[] num_config = new int[1]; mEgl.eglChooseConfig(mEglDisplay, configSpec, configs, 1, num_config); mEglConfig = configs[0]; /* * Create an OpenGL ES context. This must be done only once, an * OpenGL context is a somewhat heavy object. */ mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig, EGL10.EGL_NO_CONTEXT, null); mEglSurface = null; } /* * Create and return an OpenGL surface */ public GL createSurface(SurfaceHolder holder) { /* * The window size has changed, so we need to create a new * surface. */ if (mEglSurface != null) { /* * Unbind and destroy the old EGL surface, if * there is one. */ mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); } /* * Create an EGL surface we can render into. */ mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig, holder, null); /* * Before we can issue GL commands, we need to make sure * the context is current and bound to a surface. */ mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext); GL gl = mEglContext.getGL(); return gl; } /** * Display the current render surface. * @return false if the context has been lost. */ public boolean swap() { mEgl.eglSwapBuffers(mEglDisplay, mEglSurface); /* * Always check for EGL_CONTEXT_LOST, which means the context * and all associated data were lost (For instance because * the device went to sleep). We need to sleep until we * get a new surface. */ return mEgl.eglGetError() != EGL11.EGL_CONTEXT_LOST; } public void finish() { if (mEglSurface != null) { mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEglSurface = null; } if (mEglContext != null) { mEgl.eglDestroyContext(mEglDisplay, mEglContext); mEglContext = null; } if (mEglDisplay != null) { mEgl.eglTerminate(mEglDisplay); mEglDisplay = null; } } EGL10 mEgl; EGLDisplay mEglDisplay; EGLSurface mEglSurface; EGLConfig mEglConfig; EGLContext mEglContext;}
    2015-04-06下载
    积分:1
  • 696518资源总数
  • 106174会员总数
  • 31今日下载