radiogroup-求大神看一下哪里错了,急急急急

问题描述

求大神看一下哪里错了,急急急急
xmlns:tools=""http://schemas.android.com/tools""
android:id=""@+id/tabhost""
android:layout_width=""match_parent""
android:layout_height=""match_parent""
tools:context="".MainActivity""
tools:ignore=""HardcodedText"" >

<LinearLayout    android:layout_width=""fill_parent""    android:layout_height=""fill_parent""    android:orientation=""vertical"" >    <FrameLayout        android:id=""@android:id/tabcontent""        android:layout_width=""fill_parent""        android:layout_height=""0.0dip""        android:layout_weight=""1.0"" />    <TabWidget        android:id=""@android:id/tabs""        android:layout_width=""fill_parent""        android:layout_height=""wrap_content""        android:layout_weight=""0.0""        android:visibility=""gone"" />    <RadioGroup        android:id=""@+id/rg_bottom""        android:layout_width=""match_parent""        android:layout_height=""40dp""        android:layout_alignParentBottom=""true""        android:layout_alignParentLeft=""true""        android:gravity=""center""        android:orientation=""horizontal"" >        <RadioButton            android:id=""@+id/shouYe""            android:layout_width=""match_parent""            android:layout_height=""wrap_content""            android:layout_gravity=""center""            android:layout_weight=""1""            android:button=""@null""            android:checked=""true""            android:drawableBottom=""@drawable/select_shouye""            android:textColor=""#ffffffff"" />        <RadioButton            android:id=""@+id/sheQuZhuanTi""            android:layout_width=""match_parent""            android:layout_height=""wrap_content""            android:layout_weight=""1""            android:button=""@null""            android:drawableBottom=""@drawable/select_sqzhuanti""            android:gravity=""center""            android:textColor=""#ffffffff"" />        <RadioButton            android:id=""@+id/sheQuFengCai""            android:layout_width=""match_parent""            android:layout_height=""wrap_content""            android:layout_weight=""1""            android:button=""@null""            android:drawableBottom=""@drawable/select_sqfengcai""            android:gravity=""center""            android:textColor=""#ffffffff"" />        <RadioButton            android:id=""@+id/woDeSheQu""            android:layout_width=""match_parent""            android:layout_height=""wrap_content""            android:layout_weight=""1""            android:button=""@null""            android:drawableBottom=""@drawable/select_mysq""            android:gravity=""center""            android:textColor=""#ffffffff"" />    </RadioGroup></LinearLayout>
 package caifu.life.ZhSQ;import android.app.TabActivity;import android.content.Intent;import android.os.Bundle;import android.view.KeyEvent;import android.view.Window;import android.widget.RadioButton;import android.widget.RadioGroup;import android.widget.TabHost;import android.widget.TabWidget;import android.widget.Toast;public class MainActivity extends TabActivity  {    // 退出程序的量    private long exitTime = 0;    public static TabHost mTabHost;    public static TabHost getmTabHost() {         return mTabHost;     }      private RadioGroup gr_bottom;      private RadioButton tab_shouYe tab_zuanTi tab_fengCaitab_mine;     @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        //不要窗口标题        requestWindowFeature(Window.FEATURE_NO_TITLE);        mTabHost = getTabHost();        final TabWidget tabWidget = mTabHost.getTabWidget();          tabWidget.setStripEnabled(false);// 圆角边线不启用         //添加n个tab选项卡,定义他们的tab名,指示名,目标屏对应的类          mTabHost.addTab(mTabHost.newTabSpec(""shouye"").setIndicator(""0"")                 .setContent(new Intent(this ShouYeActivity.class)));             mTabHost.addTab(mTabHost.newTabSpec(""zuanti"").setIndicator(""1"")                    .setContent(new Intent(this ZhuanTiActivity.class)));             mTabHost.addTab(mTabHost.newTabSpec(""fengcai"").setIndicator(""2"")                    .setContent(new Intent(this FengCaiActivity.class)));             mTabHost.addTab(mTabHost.newTabSpec(""mine"").setIndicator(""3"")                    .setContent(new Intent(this MineActivity.class)));             gr_bottom = (RadioGroup)findViewById(R.id.rg_bottom);            tab_shouYe = (RadioButton)findViewById(R.id.shouYe);            tab_zuanTi = (RadioButton)findViewById(R.id.sheQuZhuanTi);            tab_fengCai = (RadioButton)findViewById(R.id.sheQuFengCai);            tab_mine = (RadioButton)findViewById(R.id.woDeSheQu);            gr_bottom.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {                 public void onCheckedChanged(RadioGroup group int id) {                     if (id == tab_shouYe.getId()) {                         mTabHost.setCurrentTab(0);                     } else if (id == tab_zuanTi.getId()) {                         mTabHost.setCurrentTab(1);                     } else if (id == tab_fengCai.getId()) {                         mTabHost.setCurrentTab(2);                     } else if (id == tab_mine.getId()) {                         mTabHost.setCurrentTab(3);                     }                 }             });             //设置当前显示哪个标签            mTabHost.setCurrentTab(0);    }    // 再按一次退出程序    @Override    public boolean onKeyDown(int keyCode KeyEvent event) {        if (keyCode == KeyEvent.KEYCODE_BACK                && event.getAction() == KeyEvent.ACTION_DOWN) {            if ((System.currentTimeMillis() - exitTime) > 2000) {                Toast.makeText(getApplicationContext()再按一次退出程序""                        Toast.LENGTH_SHORT).show();                exitTime = System.currentTimeMillis();            } else {                finish();                // 返回桌面操作                Intent home = new Intent(Intent.ACTION_MAIN);                home.addCategory(Intent.CATEGORY_HOME);                startActivity(home);            }            return true;        }        return super.onKeyDown(keyCode event);    }}求大神看一下哪里错了

Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'爆这个错

解决方案

tabhost 没有绑定 id名哦,所以
android:id=""@+id/tabhost"" 这句话 找id是tabhost 的 找不到

解决方案二:
给你的tabhost设置一个id “android.R.id.tabhost”

时间: 2024-09-12 10:05:13

radiogroup-求大神看一下哪里错了,急急急急的相关文章

java-Java求101到200的素数并输出 求大神看下哪里错了 能不能不用boolean函数改

问题描述 Java求101到200的素数并输出 求大神看下哪里错了 能不能不用boolean函数改 public class SuShu { public static void main(String[] args) { int i = 0; for(int a=101;a<200;a+=2) { for(int b=2;b<a;b++) { if(a%b!=0) { System.out.println(a); i++; } else{ break; } } } System.out.pr

c语言acm1003 求大神看看我的代码哪错了

问题描述 c语言acm1003 求大神看看我的代码哪错了 Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. Input The first line of the input

server-求大神!! jsp访问之后就是介个样子,求大神看一下是我的环境什么地方配置错了

问题描述 求大神!! jsp访问之后就是介个样子,求大神看一下是我的环境什么地方配置错了 HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: org.hiberna

c#-用C#将数据库的数据导出,结果生成的txt是空的,求大神看一下代码哪里不对?

问题描述 用C#将数据库的数据导出,结果生成的txt是空的,求大神看一下代码哪里不对? private void button1_Click(object sender, EventArgs e) { FileDialog sfd = new SaveFileDialog(); if (sfd.ShowDialog() == DialogResult.OK) { using (FileStream fstream = File.OpenWrite(sfd.FileName)) { StreamW

jsonarray-关于bmob的listview问题,求大神看看我哪里错了!

问题描述 关于bmob的listview问题,求大神看看我哪里错了! 主MainActivity代码 import java.util.List; import android.app.Activity; import android.os.Bundle; import android.widget.ListView; import android.widget.Toast; import cn.bmob.v3.Bmob; import cn.bmob.v3.BmobQuery; import

遍历-数据结构问题。二叉树,程序写了编译没错,但没办法运行。求大神看下。

问题描述 数据结构问题.二叉树,程序写了编译没错,但没办法运行.求大神看下. #include #define MAXLEN 100 using namespace std; typedef char elementType; typedef struct lBnode {elementType data; struct lBnode *lchild,*rchild; }Binode,*Bitree; void create(Bitree &T) //创建二叉链表 {char ch; cin>

tomcat-Myeclipce启动项目时后台日志,求大神看一下这是怎么回事!

问题描述 Myeclipce启动项目时后台日志,求大神看一下这是怎么回事! org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [cn.westcatr.nananiot.HomeController] for bean with name 'homeController' defined in file [F:WorkspacesMyEclipse Professional.me

ueditor-请教一个百度富文编辑器的问题,求大神看一下

问题描述 请教一个百度富文编辑器的问题,求大神看一下 直接上图吧,为什么不显示本地图片,但是选择后确定是可以用的 这是为什么?

java-JAVA求101到200的素数并全部输出 求大神看下我的编程错在哪谢谢

问题描述 JAVA求101到200的素数并全部输出 求大神看下我的编程错在哪谢谢 public class SuShu { public static void main(String[] args) { int i = 0; for(int a=101;a<200;a+=2) { for(int b=2;b<a;b++) { if(a%b!=0) { System.out.println(a); i = i + 1; } else { break; } } } System.out.prin