刚接触android,麻烦看看为什么这布局会报错!

周美文 2013-10-15 04:14:00
xml代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TabHost android:id="@+id/tabhost"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!--进账页面-->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:text="@string/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="@+id/txtIncomeTime"
android:inputType="number"
/>
<Button android:id="@+id/btnSelectIncomeDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/selectDate"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/count"/>
<EditText android:id="@+id/txtIncomeCount"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:inputType="number"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/incometype"/>
<Spinner android:id="@+id/spinnerIncomeOrg"
android:layout_width="150dp"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/type"/>
<RadioGroup android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rdbIncomeCash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cash"/>
<RadioButton
android:id="@+id/rdbIncomeCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/card"/>
</RadioGroup>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/comment"/>
<EditText android:layout_width="180dp"
android:layout_height="wrap_content"
android:inputType="text"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
>
<Button
android:id="@+id/btnIncomeOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ok"/>
<Button
android:id="@+id/btnIncomeCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cancel"/>
</LinearLayout>
</LinearLayout>
<!--支出页面-->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="支出"/>
</LinearLayout>
<!--统计页面-->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="统计"/>
</LinearLayout>
<!--设置页面-->
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>
...全文
299 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
寻找IT之路 2013-10-16
  • 打赏
  • 举报
回复
关掉模拟器,重启下
tantahe 2013-10-16
  • 打赏
  • 举报
回复
我试了可以运行啊
周美文 2013-10-16
  • 打赏
  • 举报
回复
引用 1 楼 tantahe 的回复:
你检查一下是不是demin或者string没定义。其他没什么错误。
不是的呀
周美文 2013-10-16
  • 打赏
  • 举报
回复
引用 2 楼 Lvmodel 的回复:
你给出报错信息多好?这么长

Exception raised during rendering: Could not create tab content because could not find view with id -1,大概说的是tab没有用对,可是我检查了好久没发现啊
周美文 2013-10-16
  • 打赏
  • 举报
回复
[img=https://img-bbs.csdn.net/upload/201310/16/1381890340_113038.jpg]
[/img]
引用 2 楼 Lvmodel 的回复:
你给出报错信息多好?这么长
clerklogan 2013-10-16
  • 打赏
  • 举报
回复
布局错误eclipse会在当前行有提示的吧,找到后再仔细检查下附近的代码
michunyingzheCSDN 2013-10-16
  • 打赏
  • 举报
回复
楼主,把你代码拷出来试过没有问题呢,试下把程序关掉重新打开工具。
起舞的红叶 2013-10-16
  • 打赏
  • 举报
回复
最外层不需要relativelayout换成tabhost
mr_same 2013-10-15
  • 打赏
  • 举报
回复
你给出报错信息多好?这么长
tantahe 2013-10-15
  • 打赏
  • 举报
回复
你检查一下是不是demin或者string没定义。其他没什么错误。

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧