草庐IT

Android TabHost 已弃用

coder 2023-11-28 原文

我正在创建将支持 Android 2.2 到 Android 4.1 的应用程序。 TabHost 在 Android 3.2 版中已弃用。但是所有版本都支持创建的应用程序。但我想创建 Tab bar 应用程序,它在 Android 4.2 中运行时看起来像 tab bar in Android 4.1 ,如果我在 android 3.2 version 设备中运行应用程序,它必须看起来像该设备中的 tab bar。我该怎么做。?

最佳答案

你的问题有很多要点,

  1. TabHost 不是 deprecated然而。最近 Google 弃用了 TabActivityActivityGroup
  2. 即使它被弃用了,也不意味着它不能使用。 如果 X 被弃用,这仅意味着存在名为 Y 的更好替代方案。

现在回答你的问题,你有不止一个选择

  1. 您可以按照其他答案的建议使用 ActionBarSherlock。 (编辑:ActionBarSherlock 现已弃用。)
  2. 您可以将TabHost 与 fragment 一起使用,参见我的回答here为一个 好的例子。要在 3.0 之前的 API 中使用 Fragment,您需要使用 Google's support library.

关于Android TabHost 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14272125/

有关Android TabHost 已弃用的更多相关文章

  1. ruby-on-rails - 我更新了 ruby​​ gems,现在到处都收到解析树错误和弃用警告! - 2

    简而言之错误:NOTE:Gem::SourceIndex#add_specisdeprecated,useSpecification.add_spec.Itwillberemovedonorafter2011-11-01.Gem::SourceIndex#add_speccalledfrom/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91./opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:275:in`==':und

  2. ruby - 有没有办法让 2.4.0 中的 Ruby 弃用警告静音? - 2

    从Ruby2.4.0开始,对于使用某些已弃用的功能,会出现弃用警告。例如,Bignum、Fixnum、TRUE和FALSE都会触发弃用警告。当我修复我的代码时,有相当多的代码我希望它保持沉默,尤其是在Rails中。我该怎么做? 最佳答案 moduleKerneldefsuppress_warningsoriginal_verbosity=$VERBOSE$VERBOSE=nilresult=yield$VERBOSE=original_verbosityreturnresultendend>>X=:foo=>:foo>>X=:bar

  3. ruby-on-rails - 从 gem 生成的静音弃用警告 - 2

    我正在使用unscoped_associations我的Rails5.0.0.1应用程序中的gem。我收到这个弃用警告:DEPRECATIONWARNING:alias_method_chainisdeprecated.Please,useModule#prependinstead.Frommodule,youcanaccesstheoriginalmethodusingsuper.(calledfromat/home/rhl/myapp/config/application.rb:8)DEPRECATIONWARNING:alias_method_chainisdeprecated.

  4. ruby-on-rails - Rails group_by 是否已弃用? - 2

    我有一个要分组的数组,“group_by”函数似乎适合我的情况。http://apidock.com/rails/Enumerable/group_by我在Rails3.2.13中使用它。grouped_array=my_array.group_by(&:my_function)#Assumerun'my_function'haveresult1onelement1,element3andresult2onelement2,element4,then:#grouped_array={#result1=>[element1,element3],#result2=>[element2,el

  5. ruby-on-rails - 验证事件连接!在 Rails 4 中已弃用,我们应该如何处理该功能? - 2

    我一直在关注这篇文章以与工头一起设置puma:https://www.digitalocean.com/community/articles/how-to-set-up-zero-downtime-rails-deploys-using-puma-and-foremanpuma脚本在连接后告诉verify_active_connections!但它在rails4中不可用。注释掉方法调用将使脚本运行但我不确定这是否会泄漏资源.关于这个问题,我能看到的唯一文档是:https://github.com/socialcast/resque-ensure-connected/issues/3但是

  6. ruby - 带 compass 的 ruby 弃用警告 - 2

    当我尝试像往常一样在项目上运行“bundleexeccompasswatch”时,我现在收到此警告:DEPRECATIONWARNINGonline87of/home/hedy/Sites/mywebsite.fr/src/vendor/bundle/ruby/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/css3/_deprecated-support.scss:#{}interpolationnearoperatorswillbesimplifiedinafutureversionofSass.Topreservethecurr

  7. ruby-on-rails - 弃用警告 : Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s) - 2

    我将我的Rails5.1.4应用更新到了5.2.0。我的一个模型中有以下范围:scope:by_category,lambda{|category_slug|category_ids=Category.find_by(slug:category_slug)&.subtree_idswhere(category_id:category_ids)}由于该范围,Rails返回以下错误:DEPRECATIONWARNING:Dangerousquerymethod(methodwhoseargumentsareusedasrawSQL)calledwithnon-attributeargume

  8. ruby-on-rails - 这种弃用方法如何工作? - 2

    我试图理解这个调用:deprecate:new_record?,:new?它使用了这个弃用方法:defdeprecate(old_method,new_method)class_eval我不太了解这里使用的元编程。但是,这只是别名new_record?方法的另一种方式吗-所以实际上,new_record?仍然可用,但在您使用它时会发出警告?有人愿意解释一下这是如何工作的吗? 最佳答案 好的,所以这里发生的是old_method的所有功能都已被程序员移至new_method。为了使两个名称都指向相同的功能但注意弃用,程序员放入了dep

  9. ruby-on-rails - Ruby 2.4.1 - 警告:constant::Fixnum 已弃用 - 2

    这个问题在这里已经有了答案:Ruby2.4andRails4stackleveltoodeep(SystemStackError)(3个答案)关闭5年前。我是StackOverflow和Rails的新手,所以我希望这不是一个太幼稚的问题。我正在尝试使用bin/rails服务器在本地运行我的应用程序。当我输入时,我收到以下跟踪信息:=>BootingPuma=>Rails4.2.5applicationstartingindevelopmentonhttp://localhost:3000=>Run`railsserver-h`formorestartupoptions=>Ctrl-Ct

  10. ruby-on-rails - Rails 服务器无法启动,Rails 5 中的弃用警告(MIME?Sprockets?) - 2

    我使用“railss”,但服务器无法启动。我也是刚开始当我重新启动它时,我得到了这个:=>BootingPuma=>Rails5.0.0applicationstartingindevelopmentonhttp://localhost:3000=>Run`railsserver-h`formorestartupoptionsDEPRECATIONWARNING:Sprocketsmethod`register_engine`isdeprecated.Pleaseregisteramimetypeusing`register_mime_type`thenuse`register_com

随机推荐