我升級我從SDK 22 android應用到SDK 23的Android NavigationView顏色奇怪的行爲
我只是改變了庫版本較新的一個,我的NavigationView改變。當選擇項目時出現兩個方塊,我不知道如何去除它們。
這裏是如何看起來像之前升級
這裏是我的activity.xml
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
app:layout_scrollFlags="scroll|enterAlways" />
<Button
android:visibility="@integer/test_button_visibility"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_height="match_parent">
<!-- A RecyclerView with some commonly used attributes -->
<android.support.v7.widget.RecyclerView
android:scrollbars="vertical"/>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.AppBarLayout>
<!-- The main content view -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<TextView
android:id="@+id/informationTextView"
android:visibility="gone"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:theme="@style/NavigationDrawerTheme"
app:menu="@menu/navigation_drawer_menu_items"
app:itemTextColor="@color/text_color"/>
</android.support.v4.widget.DrawerLayout>
我怎樣可以刪除它們的一部分嗎?
UPDATE
這裏是我的主題
<style name="NavigationDrawerTheme" parent="Widget.Design.NavigationView">
<item name="android:textSize">14sp</item>
<item name="android:background">@color/white_text</item>
</style>
您是否嘗試過使用'layout_width =「wrap_content」'?爲navigationview? – Mohsen
@ LinX64現在試了一下,沒有幫助 – c0rp