Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 重复id@+;appcompat\u v7 abc\u活动\u选择器\u视图中的id/image.xml:58_Android_Android Appcompat - Fatal编程技术网

Android 重复id@+;appcompat\u v7 abc\u活动\u选择器\u视图中的id/image.xml:58

Android 重复id@+;appcompat\u v7 abc\u活动\u选择器\u视图中的id/image.xml:58,android,android-appcompat,Android,Android Appcompat,创建apk时,我遇到以下错误: 重复的id@+id/图像,已在此版面中定义…abc\u活动\u选择器\u视图。xml:58在版面中(appcompat\u v7) 所以我把它洗了,还是原来的样子。此文件中确实存在重复的id@+id/图像: <?xml version="1.0" encoding="utf-8"?> <view xmlns:android="http://schemas.android.com/apk/res/android" class="android.su

创建apk时,我遇到以下错误:

重复的id@+id/图像,已在此版面中定义…abc\u活动\u选择器\u视图。xml:58在版面中(appcompat\u v7)

所以我把它洗了,还是原来的样子。此文件中确实存在重复的id@+id/图像:

<?xml version="1.0" encoding="utf-8"?>
<view xmlns:android="http://schemas.android.com/apk/res/android"
class="android.support.v7.internal.widget.ActivityChooserView$InnerLayout"
android:id="@+id/activity_chooser_view_content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
style="?attr/activityChooserViewStyle">

<FrameLayout
    android:id="@+id/expand_activities_button"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:focusable="true"
    android:addStatesFromChildren="true"
    android:background="?attr/actionBarItemBackground">

    <ImageView android:id="@+id/image"
        android:layout_width="32dip"
        android:layout_height="32dip"
        android:layout_gravity="center"
        android:layout_marginTop="2dip"
        android:layout_marginBottom="2dip"
        android:layout_marginLeft="12dip"
        android:layout_marginRight="12dip"
        android:scaleType="fitCenter"
        android:adjustViewBounds="true" />

</FrameLayout>

<FrameLayout
    android:id="@+id/default_activity_button"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:focusable="true"
    android:addStatesFromChildren="true"
    android:background="?attr/actionBarItemBackground">

    <ImageView android:id="@+id/image"
        android:layout_width="32dip"
        android:layout_height="32dip"
        android:layout_gravity="center"
        android:layout_marginTop="2dip"
        android:layout_marginBottom="2dip"
        android:layout_marginLeft="12dip"
        android:layout_marginRight="12dip"
        android:scaleType="fitCenter"
        android:adjustViewBounds="true" />

  </FrameLayout>

</view>

有没有办法解决这个问题?显然,我不能把它重命名。
我可以跳过在Lint中检查它,但是错误仍然存在,我认为这不是最好的解决方案。还有更可靠的解决方案吗?

您将收到一个重复的ID错误,因为在
android.support.v7.internal.widget.ActivityChooserView$InnerLayout
中有一个同名的视图。简单的答案是为
ImageView
使用一个新名称,并在引用它的任何地方更新代码中的名称


我可以问一下,为什么在布局中直接使用内部框架小部件?内部布局不打算直接使用,随时可能更改,这可能会在将来破坏您的代码。更好的解决方案是创建自己的布局或使用具有类似功能的公共框架小部件。使用内部小部件的风险由您自己承担。

为什么需要重复的id?我不需要它。它已经存在。你确定,当应用程序正在使用时,纯重命名不会产生错误吗?是的,你可以。您正在使用eclipse吗?在android studio中,您可以添加gradle依赖项,而不必处理这个问题是的,这里是eclipse。。。重命名修复了错误。。。希望它不会影响任何事情。