Fehler mit dem Navigation Drawer

  • Antworten:3
Florent Anders
  • Forum-Beiträge: 2

11.05.2014, 15:24:17 via Website

Hallo!

Ich programmiere momentan eine Anwendung mit Navigation Drawer und möchte bei dieser die transparente Statusbar aktivieren. Es gab einen Darstellungs-Fehler in den Fragmenten, den konnte ich beheben.

Aber ich habe weiterhin einen Fehler beim Navigation Drawer selbst und ich schaffe es einfach nicht, ihn loszuwerden. Ich verwende übrigens die V4-Support-Library...

Weiß da jemand was?

Sieht übrigens so aus:image

Hier sind meine activity_main.xml und meine drawer_list_item.xml:

<android.support.v4.widget.DrawerLayout
(xmlns musste ich entfernen wegen Spam-Prävention)
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:fitsSystemWindows="true"

android:layout_height="match_parent">

<!-- Framelayout to display Fragments -->
<FrameLayout
    android:id="@+id/frame_container"


    android:fitsSystemWindows="true"
    android:clipToPadding="true"

    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- Listview to display slider menu -->
<ListView
    android:id="@+id/list_slidermenu"
    android:layout_width="240dp"

    android:fitsSystemWindows="true"
    android:clipToPadding="false"



    android:layout_height="fill_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@color/list_divider"
    android:dividerHeight="1dp"        
    android:listSelector="@drawable/list_selector"
    android:background="@color/list_background"/>

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

drawer_list_item:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;RelativeLayout (xmlns musste ich entfernen wegen Spam-Pr&auml;vention)
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;48dp&quot;
android:fitsSystemWindows=&quot;true&quot;
android:clipToPadding=&quot;false&quot;
android:background=&quot;@drawable/list_selector&quot;&gt;

&lt;ImageView
    android:id=&quot;@+id/icon&quot;
    android:layout_width=&quot;25dp&quot;
    android:clipToPadding=&quot;true&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:fitsSystemWindows=&quot;true&quot;
    android:layout_alignParentLeft=&quot;true&quot;
    android:layout_marginLeft=&quot;12dp&quot;
    android:layout_marginRight=&quot;12dp&quot;
    android:contentDescription=&quot;@string/desc_list_item_icon&quot;
    android:src=&quot;@drawable/ic_home&quot;
    android:layout_centerVertical=&quot;true&quot; /&gt;

&lt;TextView
    android:id=&quot;@+id/title&quot;
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;match_parent&quot;
    android:fitsSystemWindows=&quot;true&quot;
    android:clipToPadding=&quot;true&quot;
    android:layout_toRightOf=&quot;@id/icon&quot;
    android:minHeight=&quot;?android:attr/listPreferredItemHeightSmall&quot;
    android:textAppearance=&quot;?android:attr/textAppearanceListItemSmall&quot;
    android:textColor=&quot;@color/list_item_title&quot;
    android:gravity=&quot;center_vertical&quot;
    android:paddingRight=&quot;40dp&quot;/&gt;

&lt;TextView android:id=&quot;@+id/counter&quot;
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:fitsSystemWindows=&quot;true&quot;
    android:clipToPadding=&quot;true&quot;
    android:background=&quot;@drawable/counter_bg&quot;
    android:layout_alignParentRight=&quot;true&quot;
    android:layout_centerVertical=&quot;true&quot;
    android:layout_marginRight=&quot;8dp&quot;
    android:textColor=&quot;@color/counter_text_color&quot;/&gt;

</RelativeLayout>

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

11.05.2014, 15:40:16 via Website

Was ist dein Problem genau?
Hast du ein Bild wie es richtig sei soll?

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten
Florent Anders
  • Forum-Beiträge: 2

11.05.2014, 15:46:08 via Website

Das Problem ist, dass zwei Einträge im Drawer nicht richtig angezeigt werden, und zwar "LookingFor" und "Enzyklopädie".

Ich gehe daher davon aus, dass dem Drawer nicht bewusst ist, dass die ActionBar über den Einträgen liegt.

Es müsste eigentlich so aussehen:

image

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

11.05.2014, 19:31:38 via Website

mach in den Navidrawer Fragment z.b folgendes:

android:paddingTop=&quot;?android:actionBarSize&quot;

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten