{"id":846,"date":"2015-07-03T16:54:42","date_gmt":"2015-07-03T08:54:42","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=846"},"modified":"2026-08-18T12:58:42","modified_gmt":"2026-08-18T04:58:42","slug":"android%e4%b8%adtabhost%e4%b8%bb%e7%95%8c%e9%9d%a2%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=846","title":{"rendered":"Android\u4e2dTabHost\u4e3b\u754c\u9762\u5b9e\u73b0"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\">App \u4e3b\u754c\u9762\u5e38\u7528\u5e95\u90e8<strong>\u9009\u9879\u5361\uff08Tab\uff09<\/strong>\u505a\u5165\u53e3\u3002\u672c\u7bc7\u8bb2\u8f83\u53e4\u8001\u7684\u4e00\u5957\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabActivity<\/code> + <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabHost<\/code>\uff1a\u5e03\u5c40\u4e09\u533a\u3001\u7cfb\u7edf\u9875\u5361\u3001\u518d\u7528\u81ea\u5b9a\u4e49 View \u6362\u56fe\u6807\u548c\u6587\u5b57\u9009\u4e2d\u6001\u3002FragmentActivity \u65b9\u6848\u53e6\u6587\u518d\u5199\u3002<\/p>\n<\/blockquote>\n<p><!--more--><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001Tab \u4e3b\u754c\u9762\u957f\u4ec0\u4e48\u6837<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u5148\u770b\u4e00\u4e2a\u5e95\u90e8\u9875\u5361\u7684 App \u4e3b\u754c\u9762\uff1a\u70b9\u4e0d\u540c Tab \u5207\u5230\u4e0d\u540c\u5185\u5bb9\u9875\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/anzhi1.gif\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-847\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/anzhi1.gif\" alt=\"anzhi1\" width=\"273\" height=\"433\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u5c4f\u5e55\u901a\u5e38\u5206\u6210\u4e09\u5757\uff1a<strong>\u6807\u9898\u533a<\/strong>\u3001<strong>\u9875\u5361\u5185\u5bb9\u533a<\/strong>\u3001<strong>\u9875\u5361\u533a<\/strong>\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/QQ\u255c\u256a\u2550\u255d20150703163230.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-848\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/QQ\u255c\u256a\u2550\u255d20150703163230.png\" alt=\"QQ\u255c\u256a\u2550\u255d20150703163230\" width=\"387\" height=\"385\" \/><\/a><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u5e03\u5c40\uff1aTabHost + TabWidget + FrameLayout<\/span><\/h2>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabWidget<\/code> \u662f\u9875\u5361\u6761\uff0c<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">FrameLayout<\/code>\uff08<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">@android:id\/tabcontent<\/code>\uff09\u662f\u5185\u5bb9\u533a\u3002\u5e95\u90e8 Tab \u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">layout_alignParentBottom<\/code>\uff0c\u5185\u5bb9\u533a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">layout_above<\/code> \u9876\u5728 Tab \u4e0a\u9762\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;TabHost xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:id=\"@android:id\/tabhost\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\" &gt;\n\n    &lt;RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" &gt;\n\n        &lt;TabWidget\n            android:id=\"@android:id\/tabs\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_alignParentBottom=\"true\"\n            android:background=\"@android:color\/white\" &gt;\n        &lt;\/TabWidget&gt;\n\n        &lt;FrameLayout\n            android:id=\"@android:id\/tabcontent\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_above=\"@android:id\/tabs\" &gt;\n        &lt;\/FrameLayout&gt;\n    &lt;\/RelativeLayout&gt;\n\n&lt;\/TabHost&gt;<\/code><\/pre>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u4ee3\u7801\uff1anewTabSpec + Intent \u5185\u5bb9\u9875<\/span><\/h2>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">getTabHost()<\/code> \u62ff\u5230 Host\uff0c\u6bcf\u4e2a\u9875\u5361\u4e00\u4e2a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabSpec<\/code>\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setIndicator<\/code> \u8bbe\u6807\u9898\uff0c<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setContent(Intent)<\/code> \u6307\u5411\u5bf9\u5e94 Activity\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    setContentView(R.layout.activity_tab1_layout);\n\n    TabHost tabHost = getTabHost();\n\n    TabSpec tabSpec1 = tabHost.newTabSpec(\"tab1\");\n    tabSpec1.setIndicator(\"\u9875\u53611\");\n    tabSpec1.setContent(new Intent(context, RadioButtonActivity.class));\n\n    TabSpec tabSpec2 = tabHost.newTabSpec(\"tab2\");\n    tabSpec2.setIndicator(\"\u9875\u53612\");\n    tabSpec2.setContent(new Intent(context, LinerLayoutAcitiy.class));\n\n    TabSpec tabSpec3 = tabHost.newTabSpec(\"tab3\");\n    tabSpec3.setIndicator(\"\u9875\u53613\");\n    tabSpec3.setContent(new Intent(context, SimpleListActivity.class));\n\n    tabHost.addTab(tabSpec1);\n    tabHost.addTab(tabSpec2);\n    tabHost.addTab(tabSpec3);\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u8fd9\u6837\u51fa\u6765\u7684\u662f\u7cfb\u7edf\u9ed8\u8ba4\u9875\u5361\u3002\u8981\u56fe\u6807+\u9009\u4e2d\u8272\uff0c\u6539\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setIndicator(View)<\/code> \u585e\u81ea\u5b9a\u4e49 View\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u81ea\u5b9a\u4e49\u9875\u5361 View \u4e0e selector<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">inflate \u9875\u5361\u5e03\u5c40\uff0c\u6309 Tab \u5e38\u91cf\u586b\u6807\u9898\u548c\u56fe\u6807 selector\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">private View createIndicatorView(int tab) {\n    View view = mLayoutInflater.inflate(R.layout.view_tab_item_layout, null);\n\n    TextView titleTxt = (TextView) view.findViewById(R.id.tab_title);\n    ImageView iconImg = (ImageView) view.findViewById(R.id.tab_icon);\n\n    switch(tab){\n    case HOME_TAB:\n        titleTxt.setText(\"\u9996\u9875\");\n        iconImg.setImageResource(R.drawable.selector_drawable_home_tab);\n        break;\n    case CONTENT_TAB:\n        titleTxt.setText(\"\u5546\u5bb6\");\n        iconImg.setImageResource(R.drawable.selector_drawable_content_tab);\n        break;\n    case MORE_TAB:\n        titleTxt.setText(\"\u66f4\u591a\");\n        iconImg.setImageResource(R.drawable.selector_drawable_set_tab);\n        break;\n    }\n\n    return view;\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u9875\u5361\u56fe\u6807 selector\uff08pressed \/ selected \u7528\u4eae\u56fe\uff0c\u9ed8\u8ba4\u6697\u56fe\uff09\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;selector xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"&gt;\n\n    &lt;item android:drawable=\"@drawable\/ic_menu_more_on\" android:state_pressed=\"true\"&gt;&lt;\/item&gt;\n    &lt;item android:drawable=\"@drawable\/ic_menu_more_on\" android:state_selected=\"true\"&gt;&lt;\/item&gt;\n    &lt;item android:drawable=\"@drawable\/ic_menu_more_off\"&gt;&lt;\/item&gt;\n\n&lt;\/selector&gt;<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u9875\u5361\u6587\u5b57\u989c\u8272 selector\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;selector xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"&gt;\n\n    &lt;item android:state_pressed=\"true\" android:color=\"@color\/green_tab\"&gt;&lt;\/item&gt;\n    &lt;item android:state_selected=\"true\" android:color=\"@color\/green_tab\"&gt;&lt;\/item&gt;\n    &lt;item android:color=\"@color\/darker_gray_tab\"&gt;&lt;\/item&gt;\n\n&lt;\/selector&gt;<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u9875\u5361 item \u5e03\u5c40\uff08\u6587\u5b57\u989c\u8272\u3001\u56fe\u6807\u90fd\u6307\u5411 selector\uff09\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    android:gravity=\"center\"\n    android:paddingTop=\"3dp\"\n    android:paddingBottom=\"3dp\"&gt;\n\n    &lt;TextView\n        android:id=\"@+id\/tab_title\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:textColor=\"@drawable\/selector_color_home_tab\"\n        android:text=\"\u9996\u9875\" \/&gt;\n\n    &lt;ImageView\n        android:id=\"@+id\/tab_icon\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:src=\"@drawable\/selector_drawable_home_tab\"\/&gt;\n\n&lt;\/LinearLayout&gt;<\/code><\/pre>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u89d2\u8272<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u63a7\u4ef6 \/ \u65b9\u6cd5<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u505a\u4ec0\u4e48<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5bb9\u5668<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabHost<\/code><\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">id \u5fc5\u987b\u662f <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">@android:id\/tabhost<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u9875\u5361\u6761<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">TabWidget<\/code><\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">@android:id\/tabs<\/code>\uff0c\u53ef\u8d34\u5e95<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5185\u5bb9\u533a<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">FrameLayout<\/code><\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">@android:id\/tabcontent<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7cfb\u7edf\u6837\u5f0f<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setIndicator(String)<\/code><\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7eaf\u6587\u5b57\u9875\u5361<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u81ea\u5b9a\u4e49<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">setIndicator(View)<\/code><\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u56fe\u6807 + \u6587\u5b57 selector<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 1em 0px;\">\u5b9e\u73b0\u6548\u679c\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/tabhost1.gif\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-849\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/07\/tabhost1.gif\" alt=\"tabhost1\" width=\"290\" height=\"468\" \/><\/a><\/p>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aTabHost \u4e3b\u754c\u9762 = \u5e95\u90e8 TabWidget + \u4e0a\u9762 tabcontent\uff1b\u7cfb\u7edf\u9875\u5361\u7528 setIndicator(\u6587\u5b57)\uff0c\u597d\u770b\u7684\u9875\u5361\u7528\u81ea\u5b9a\u4e49 View + selector \u6362\u56fe\u6807\u548c\u9009\u4e2d\u8272\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>App \u4e3b\u754c\u9762\u5e38\u7528\u5e95\u90e8\u9009\u9879\u5361\uff08Tab\uff09\u505a\u5165\u53e3\u3002\u672c\u7bc7\u8bb2\u8f83\u53e4\u8001\u7684\u4e00\u5957\uff1aTabActivity + TabHost\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[195],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/846"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=846"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/846\/revisions"}],"predecessor-version":[{"id":855,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/846\/revisions\/855"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}