经验 - 实现Tab功能的几种方式: 1.(废弃)继承自TabActivity + TabHost 布局 + Activity 内容 1.1:TabActivity为ActivityGroup[在版本13里被放弃]子类 1.2:使用getTabHost() 获得TabHost 对象 1.3:使用 newTabSpec(...).setContent(Intent) 添加Tab标签与内容 2.(废弃)继承自ActivityGroup + TabHost布局 + Activity 内容 2.1:ActivityGroup在版本13里被放弃 2.2:使用findViewById 获得TabHost 对象 2.3:使用setup(new LocalActivityManager(this, true))初始化 2.4:使用 newTabSpec(...).setContent(Intent) 添加Tab标签与内容 3.(简单)继承自FragmentActivity + FragmentTabHost 布局 + Fragment 内容 3.1:使用findViewById 获得FragmentTabHost 对象 3.2:使用setup(this, getSupportFragmentManager(), R.id.realtabcontent)初始化 3.3:使用addTab(newTabSpec().setIndicator(),Fragment.class, null) 添加Tab标签与内容 4.(复杂)继承自FragmentActivity + TabHost 布局 + ViewPager布局 + Fragment 内容 4.1:使用findViewById 获得TabHost 对象 4.2:使用setup()初始化 4.3:使用TabHost.addTab(tabSpec.setContent(DummyTabFactory));添加Tab标签与空内容 4.4:在TabHost.onTabChanged中控制ViewPager的实际显示 4.5:滑动时在ViewPager.onPageSelected 中控制Tab标签的选择。 PS:当Tab标签数量固定且不追求和系统保持一致的标签效果,的情况下这里的TabHost布局有些多余。 如 :特有应用需要的Tab标签固定,且有自己的一套显示效果,那么这里完全无需TabHost布局。 http://blog.youkuaiyun.com/wangjinyu501/article/details/8169924/ 5.(DIY)继承自FragmentActivity + 自定义布局 + ViewPager布局 + Fragment 内容 5.1:自定义布局中嵌入固定Tab标签元素 5.2:在标签元素点击事件中控制ViewPager的实际显示 5.3:滑动时在ViewPager.onPageSelected 中控制标签元素的选择。
相关推荐
Angular 相关的知识点和项目汇总
Angular 知识点和项目汇总
Android初级控件TabHost
TabHost我们都知道是用来实现导航栏布局来切换页面的,这个也是元老级的控件了,现在逐渐被TabLayout,BottomNavigationBar,使用RadioButton自定义。。。等等给取代了。TabLayout有个好处就是它添加的是Activity而不像上面那些全部使用Fragment来显示内容。1.实现的效果图2.主布局中使用TabHost<?xml version="1.0" enc
Ubuntu 20.04 环境下Autoware.universe 与 Carla 0.9.13 联合仿真
安装内容: ROS Galactic Autoware.universe based on ROS Galactic Carla 0.9.13 UnrealEngine 4.26 Openplanner (additional files: op-bridge/op-agent/scenariorunner/map data)
Android - TabHost 选项卡功能用法详解
一、实例 二.、TabHost介绍 TabHost组件可以在界面中存放多个选项卡, 很多软件都使用了改组件进行设计; 1. TabHost常用组件 TabWidget : 该组件就是TabHost标签页中上部 或者 下部的按钮, 可以点击按钮切换选项卡; TabSpec : 代表了选项卡界面, 添加一个TabSpec即可添加到TabHost中
Lisflood
文献:基于SWMM和LISFLOOD-FP模型的居住区低影响开发模拟评价。问题:多个节点溢流同时,不行,待解决。目录下,cmd命令行。
Triton推理服务器实战:如何为PaddleOCR的ONNX模型配置动态批处理和并发推理
本文详细介绍了如何使用Triton推理服务器为PaddleOCR的ONNX模型配置动态批处理和并发推理,以提升GPU利用率和推理性能。通过实战案例和参数调优指南,帮助开发者解决高并发场景下的性能瓶颈问题,实现从实验室到生产环境的高效部署。
TabActivity,LocalActivityManager,TabHost,TabWidget深度分析
TabAcitivity继承自AcitivtyGroup,AcitivityGroup的主要作用是创建一个LocalActivityManger,然后把activity的onCreate等事件传递给LocalActivity来处理,作用仅此而已,非常简单。 TabActivit
基于Blender软件对Matterport3D数据集场景可视化
使用Blender软件对 Matterport3D 中的室内场景进行可视化。
tabhost简单使用及tabhost源码分析
本文原创http://blog.youkuaiyun.com/yanbin1079415046,转载请注明出处。 TabHost是一个简单的控件。TabHost的使用有两种方式,一种是继承TabActivity,从中取得TabHost。另一种方式是通过findViewById来找到你布局中定义的TabHost。如果你要仿TabHost也不难,根据TabHost的原理,我们可以通过一个LinearLayo
VSCode PlantUML 插件超详细教程:从安装配置到实战绘图全流程
VSCode PlantUML 插件超详细教程:从安装配置到实战绘图全流程
Python爬虫实战:使用Scrapy+Playwright高效获取电力市场数据
本文将详细介绍如何使用Python构建一个高效的电力市场数据爬虫系统。我们将结合Scrapy框架和Playwright浏览器自动化工具,解决电力市场网站常见的反爬机制,实现数据的稳定抓取。文章包含完整的项目搭建流程、代码实现、数据处理方案以及部署建议,帮助读者掌握现代爬虫开发的核心技术。关键词:Python爬虫、Scrapy、Playwright、电力市场、数据采集、反爬对策python复制下载# 基本字段region = scrapy.Field() # 区域。
Android控件 TabHost,Android控件之TabHost用法实例分析
本文实例讲述了android控件之tabhost用法。分享给大家供大家参考。具体如下:以下通过tabhost实现android选项卡。main.xml布局文件:android:layout_width="fill_parent"android:layout_height="fill_parent">android:layout_width="fill_parent"android:layou...
[特殊字符] 从零构建携程/飞猪机票价格爬虫:Python异步抓取与反爬对抗实战
在出行决策、竞品分析、价格预测模型训练等场景中,稳定获取携程(Ctrip)和飞猪(Fliggy)的实时机票价格波动数据是刚需。然而,这两大平台均部署了业界顶尖的反爬体系——包括但不限于:动态请求签名(SignToken设备指纹采集(UACanvasWebGL接口参数加密(X-Sign_abtestcookie混淆)频率限制与 IP 封禁(滑动窗口 + 行为检测)目录前言:为什么需要自建机票价格爬虫?一、技术选型与项目架构1.1 核心技术栈1.2 系统架构图(文字描述)1.3 法律与道德声明。
对TabHost、TabWidget的理解分析
要用到tab组件,布局layout中必须有TabHost文件,它有一个id,比如android:id="@+id/tabhost" 或者android:id="@android:id/tabhost" 在TabHost中一般必须有TabWidget,这个主要是用来处理tab的位置、属性等。一般还有FrameLayout组件,用于定义显示的在Tab下显示的组件。 例如: TabH...
NTscan扫描工具
ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
TabHost源码分析
TabHost extends FrameLayout关键属性:private TabWidget mTabWidget;//选项卡标签,继承自LinearLayout private FrameLayout mTabContent;//显示内容的区域 private List<TabSpec> mTabSpecs;//选项卡组protected int mCurrentTab = -1;//当前选
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
TabHost+Fragment分析
总结开发使用tabHost+Fragment的使用步骤: [b]1、在Activity的布局文件中使用TabHost[/b] [code="java"] [/code] [b]2、...
win10 跳过U8环境检测的IE WebControls.rar
win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。
创建TabHost的两种方式的简单分析
最近做了一个TabHost的界面,在做的过程中发现了一些问题,故和大家分享一下。 首先我的界面如下: 目前就我所知,创建TabHost有两种方式,第一种是继承TabActivity类,然后用getTabHost方法来得到一个TabHost的实例,然后就可以给这个TabHost添加Tab了。示例代码如下: public class PlotHost extends TabActivit
TabActivity,LocalActivityManager,TabHost,TabWidget深度分析(一)
本人原创,转载请注明:http://blog.youkuaiyun.com/fzh0803/archive/2011/06/21/6559081.aspx TabAcitivity继承自AcitivtyGroup,AcitivityGroup的主要作用是创建一个LocalActivityManger,然后把activity的onCreate等事件传递给LocalActivity来处理,作用仅此而已
TabHost实现机制_源码分析
0.TabHost使用Demo 布局文件: android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > android:layout_width="match_parent" android:layout_heigh
TabActivity,LocalActivityManager,TabHost,TabWidget深度分析(一) .
TabAcitivity继承自AcitivtyGroup,AcitivityGroup的主要作用是创建一个LocalActivityManger,然后把activity的onCreate等事件传递给LocalActivity来处理,作用仅此而已,非常简单。 TabActivity真正重要的包括三部分,TabHost,TabWidget,LocalActivityManager. T...

578



被折叠的 条评论
为什么被折叠?



