android Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Must specify unique

今天写了一个静态得fragment,好久没写了,一写就出现问题了,先看下布局文件

<LinearLayout 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:orientation="horizontal"

>

<fragment

android:name="com.mama.fragment.Fragment1"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="3"

/>

<fragment

android:name="com.mama.fragment.Fragment2"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="5"

/>

</LinearLayout>

一运行就报错,错误日记如下:

Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Must specify unique android:id, android:tag, or have a parent with an id for com.mama.fragment.Fragment1

不过看错误提示是说给这个静态fragment一个唯一的标示 比如定义id  ,或者tag都行, 哪我们加个id就ok了 解决!

发现

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-26 06:58:06

android Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Must specify unique的相关文章

Android错误之java.lang.RuntimeException: Binary XML file line #160: You must supply a layout_width attr

在调整布局后运行项目出现如下错误: 我们根据提示找到布局文件的160行: 发现忘记定义宽度属性,添加: 则编译正常通过. 喜欢的朋友请关注我哦!谢谢支持! 版权声明:本文为博主原创文章,未经博主允许不得转载.

错误: java.lang.RuntimeException: Binary XML file line #7: You must supply a layout_height attribute.

java.lang.RuntimeException: Binary XML file line #7: You must supply a layout_height attribute. 这个错误有可能是你指定了高度,但是在对应的dpi下没有声明这个dimen高度导致的错误. <RelativeLayout android:layout_width="match_parent" android:layout_height="@dimen/titlebar_heigh

ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id

出现场景:当点击"分类"再返回"首页"时,发生error退出 BUG描述:Caused by: java.lang.IllegalArgumentException: Binary XML file line #23: Duplicate id 0x7f0d0054, tag null, or parent id 0xffffffff with another fragment for com.example.sxq123.iljmall.FragmentCatag

Android Caused by: java.lang.IllegalArgumentException: column &#39;_id&#39; does not exist

出错原因:在查询整个sqlite数据库时,没有查询到 "_id" 这一列. 原来的代码是:mSQLiteDatabase.query(table_name, new String[] {_title}, null, null, null, null, null); 修改后的代码为:mSQLiteDatabase.query(table_name, null, null, null, null, null, null); 这里的 new String[] {MyEvent._title}

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class 异常解决方案: 是因为设置background的图片太大了,造成了内存溢出,在Activity设置onCreate

Android广播接收器注册问题:Caused by: java.lang.IllegalArgumentException: Receiver not registered

1.程序中明明使用如下方法进行了广播的注册和解除注册: mContext.registerReceiver(downloadReceiver, filter); mContext.unregisterReceiver(downloadReceiver); 但程序运行过程中还是有一下问题: android.app.IntentReceiverLeaked: Activity *********** has leaked IntentReceiver *********** that was ori

Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class android.support.design.widget.TabLayout,TableLayout引起页面崩溃

在使用TableLayout的时候,运行引用程序直接Crash. FATAL EXCEPTION: main Process: com.edaixi.activity, PID: 9703 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.edaixi.activity/com.edaixi.activity.PriceCenterActivity}: android.view.InflateExcept

Caused by: java.lang.IllegalArgumentException: addChild: Child name &#39;localhost&#39; is not unique

1.错误描述 严重: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl

Caused by java lang IllegalArgumentException addChild Chi

1.错误描述 严重: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl