336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
NavigationView를 커스텀화 하기에 좋은 설명이 있어서 공유하고자 글을 씁니다.
itemBackground
, itemIconTint
and itemTextColor
are simple xml-attributes that can be set, though you have to use a custom prefix instead of the android:
one.
Example
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Other layout views -->
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:itemBackground="@drawable/my_ripple"
app:itemIconTint="#2196f3"
app:itemTextColor="#009688"
app:headerLayout="@layout/nav_header"
app:menu="@menu/drawer_view" />
</android.support.v4.widget.DrawerLayout>
So if you wan't to customize the color of the text (e.g. pink when unchecked and teal when checked) you should use a ColorStateList
.
Example
Create a new *.xml file in /res/color
- let's name it state_list.xml - with the following content:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is used when the Navigation Item is checked -->
<item android:color="#009688" android:state_checked="true" />
<!-- This is the default text color -->
<item android:color="#E91E63" />
</selector>
and the simply reference it like this: app:itemTextColor="@color/state_list"
The same goes for itemIconTint
. itemBackground
expects a resource id. See the docs as well.
출처 : http://stackoverflow.com/a/30594875/3534559
'나의 플랫폼 > 안드로이드' 카테고리의 다른 글
[Android] Material Design Ripple Animation (2) | 2016.01.07 |
---|---|
[Android] Font Library (2) | 2016.01.07 |
[Android] TextView에 HTML 코드를 넣을 때 (0) | 2016.01.05 |
[Android] 강제적으로 Toolbar arrow 변경 (0) | 2016.01.05 |
[Android] ResizableImageView (0) | 2015.12.29 |