2014-09-30 105 views
1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/mylistview" 
     android:layout_gravity="center_horizontal" 
     /> 
</LinearLayout> 

我在我的项目已经这样布局和AndroidStudio以红色突出部分(@ + ID/mylistview),但一切工作正常, 我可以膨胀XML也findViewById(R。 id.mylistview); 无法找出问题,将鼠标悬停在上面我收到此消息 “顶层元素未完成”。 通过使用ExpandableListView更改ListView,错误消失。ID标签用红色下划线

+0

看起来像我的错误。这里有一些可能的解决方案,但他们都没有为TO工作:http://stackoverflow.com/questions/25058218/id-adview-is-red-why – 2014-09-30 17:39:42

回答

0

在下面的链接中有一个错误报告,报告了一个非常类似的问题。也许这是一个Android Studio错误?它在Eclipse中给出了同样的错误吗?如果没有,可能是下面报告的同样的错误。

https://code.google.com/p/android/issues/detail?id=55633

+0

没有错误在Eclipse – fcicer 2014-10-02 00:47:59

+0

正如我所说,我很漂亮确定你在这里得到的是一个Android Studio错误。您可以提交错误报告;只要确保它仍然是最新版本中的问题。 – Jim 2014-10-03 14:10:06