[Android] - NavigationView state_checked 배경색상 변경
Android Java 2017. 12. 14. 15:10for( int i = 0; i < navigation.getMenu().size(); i++ ) {
MenuItem tot = navigation.getMenu().getItem( i );
int tmpSize = tot.getSubMenu().size();
for( int j = 0; j < tmpSize; j++ ) {
MenuItem temp = tot.getSubMenu().getItem( j );
temp.setChecked( false );
temp.setCheckable( true ); // 이놈을 해줘야 selector 에서 checked가 먹힘
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/left_menu_background_over"
android:state_checked="true" /> // 이친구
<item
android:drawable="@android:color/transparent"
android:state_checked="false" />
</selector>
'Android Java' 카테고리의 다른 글
[Android Java] - RecyclerView 리스트 멀티셀렉트 해제 ( RecyclerView Disable Multiple select, splitMotionEvents ) (0) | 2018.07.17 |
---|---|
[Android] - Intent.ACTION_GET_CONTENT FileName 찾기 (0) | 2018.03.27 |
[Android] - Bitmap from uri ( PS. ImageSize small or normal ) (0) | 2017.12.07 |
[Android] - WebView loadData 한글 깨짐 ( UTF-8 ) 인코딩 (0) | 2017.11.29 |
[Android] - ListView Scroll on bottom event (0) | 2017.11.29 |