2014-05-23 92 views
5

每当我在android.support.v4.widget.DrawerLayout内的ViewGroup内有Views时,Eclipse的自动完成开始奇怪。它不DrawerLayout显示大多数的属性Eclipse内容辅助工具无法正常工作Android布局

示例 - >的LinearLayout - > ImageView的:

Autocomplete not working

在前面的屏幕截图,你可以看到我输入 “android:scale ...” 和IDE的智能感知不显示我的ImageView android:scaleType

如果我使用Eclipse的属性窗口ImageView,我可以看到,它只是为“View”显示基本属性(而不是为ImageView ...):

Eclipse Property Window

现在,如果ImageView的不是DrawerLayout的后裔,我把它放在别的地方,自动完成正常工作:

Now It Works...

我已经看过相关的问题如:

,但他们都已经死了,没有答案了好一阵子......

内容助攻次数不工作(无论是TextViews,EditText上,按钮.. )我在DrawerLayout中添加。它只提示'基本'属性。

有没有人知道为什么会发生这种情况或如何解决这个问题?

样品布局:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/some_image" /> 
    </LinearLayout> 

    <RelativeLayout 
     android:id="@+id/drawer_view" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" > 
    </RelativeLayout> 

</android.support.v4.widget.DrawerLayout> 
+1

当使用支持包Widgets时,这是一个常见的场景 - http:// stackoverflow。COM /问题/ 22537733 /无布局宽度属性示出的 - 在选项一览时-使用-drawerlayout合ADT –

回答

1

只给一些要关闭这家5个月大的问题,我还要举和link to Atul O Holic's answer。感谢Dileep Perla指引我。

当使用支持包Widgets时,这是一种常见的情况(一个奇怪的 也是如此)。

在这里您使用,android.support.v4.widget.DrawerLayout,因此 问题。伴随着我很多时间。

您也可以尝试这里提到的几个选项。

0

我发现在这种情况下使用标签可以得心应手。只需将抽屉内部的布局放置在单独的布局文件中,然后将其包含在抽屉布局中即可。