5

Whenever I have Views inside a ViewGroup inside a android.support.v4.widget.DrawerLayout, Eclipse's autocomplete starts working weird. It doesn't display most of the properties

Example with DrawerLayout -> LinearLayout -> ImageView:

Autocomplete not working

In the previous screenshot, you can see that I typed "android:scale..." and the IDE's intellisense isn't showing me the ImageView's android:scaleType

If I use Eclipse's Properties window for the ImageView, I can see that it is only displaying the basic properties for "View" (and not for ImageView...):

Eclipse Property Window

Now if the ImageView is not a descendant of the DrawerLayout and I put it somewhere else, the autocomplete works properly:

Now It Works...

I've seen related questions such as:

but they have been dead with no answers for quite a while...

Content assist doesn't work for Views (be it TextViews, EditText, Buttons...) that I add inside the DrawerLayout. It only suggests the 'basic' properties.

Does anybody know why this happens or how to fix this?

Sample layout:

<?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>
Community
  • 1
  • 1
user1987392
  • 3,921
  • 4
  • 34
  • 59
  • 1
    When using support package Widgets this is a common scenario - http://stackoverflow.com/questions/22537733/no-layout-width-attribute-shown-in-option-list-when-using-drawerlayout-in-adt – Dileep Perla Jun 24 '14 at 02:15

2 Answers2

1

Just to give some closure to this 5 months-old question, I'll quote and link to Atul O Holic's answer. Thanks to Dileep Perla for pointing me there.

When using support package Widgets this is a common scenario (a weird one too).

Here you using, android.support.v4.widget.DrawerLayout and hence the issue. Happened with me a lot of time.

You can also try couple of options mentioned here.

Community
  • 1
  • 1
user1987392
  • 3,921
  • 4
  • 34
  • 59
0

I've found that using the tag can be handy in this case. Just put your layout that is inside the drawer in a separate layout file and then include it inside the drawer layout.

LowDev1
  • 1,108
  • 2
  • 10
  • 19