2015-12-15 5 views
0

Добавил новую активность в приложение для Android quiz, чтобы реализовать навигационный ящик с тенью. Этот ящик тень была оказана в фрагменте NavigationDrawerFragment:Android drawer shadow shifted

mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); 

Однако тень была сдвинута:

shifted drawer shadownormal drawer shadow

смещенный Тень против Normal Shadow

Второй скриншот происходит от другого андроидного проекта quizf, основанный на шаблоне фрагмента андроида. Он создан для выяснения причин, почему викторины не работал. Сравнивая эти два проекта, я все еще не могу понять, где разница. Может кто-нибудь помочь?


викторины по drawer_main2.xml (сдвинуты)

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#cccc" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    tools:context="fr.esigelec.cs.quiz.NavigationDrawerFragment" /> 

quizf drawer_main.xml (нормальный)

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:background="#cccc" 
    tools:context=".NavigationDrawerFragment" /> 
+0

да, мы можем помочь вам, но, пожалуйста, добавьте код XML как для – piotrek1543

+0

скажите, пожалуйста, что другие XML-файлы я должен предоставить @ piotrek1543 –

+0

firtst всех, я заметил, что вы используете другой контекст как в классе – piotrek1543

ответ

1

Yours макеты отличаются в tools:context атрибута:

викторины по drawer_main2.xml (сдвинуты)

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#cccc" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    tools:context="fr.esigelec.cs.quiz.NavigationDrawerFragment" /> 

quizf drawer_main.xml (нормальный)

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:background="#cccc" 
    tools:context=".NavigationDrawerFragment" /> 

Попробуйте найти, если первый один tools:context не вызывают проблему изменив его значение на второе.