Skip to content Skip to sidebar Skip to footer

Navigation Drawer Rendering Error In Adt Layout Editor

Copy

Solution 2:

This is fixed in version 18 of the support library, released in July.

in Eclipse right click your project > select android tools > add support library.

Fixed. :)

Solution 3:

From another Question I solved the problem by extending DrawerLayout, and forcing the correct Measure_Specs:

publicclassCustomDrawerLayoutextendsDrawerLayout {

    publicCustomDrawerLayout(Context context) {
        super(context);
    }

    publicCustomDrawerLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    publicCustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @OverrideprotectedvoidonMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        widthMeasureSpec = MeasureSpec.makeMeasureSpec(
                MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY);
        heightMeasureSpec = MeasureSpec.makeMeasureSpec(
                MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

}

Solution 4:

Asmok's answer is nice but I'm this type of person always forgetting to reverse such "temporary" edits. (In other words temporary may become very big ^^)

So instead I use the <include> tag and split the layout in two files.

<android.support.v4.widget.DrawerLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/drawer_layout"android:layout_width="match_parent"android:layout_height="match_parent"><!-- The main content view --><includelayout="@layout/main_layout" /><!-- The navigation drawer --><includelayout="@layout/navigation_drawer"/></android.support.v4.widget.DrawerLayout>

For the main layout (which is the UI of the activit in question) I can now use Eclipse's graphical editor as all the content lives in a single file main_layout.xml. Furthermore I can easily include the navigation drawer in different activities without the need to copy and paste the code.

Solution 5:

The easiest solution I found was to put in the preview Theme.Holo.Light.Dialog.FixedSize functional and peaceful ...

Image here

Post a Comment for "Navigation Drawer Rendering Error In Adt Layout Editor"