返回
顶部

修改密码

Using Vector Assets for Icons in Android Studio 1.4

+1

-1

收藏

+1

-1

点赞0

评论0

Since Android Studio 1.4, we can use Vector Assets which was earlier restricted to Lollipop alone. This is more efficient since one drawable which requires multiple instances saved in different density folders will now be replaced by just ONE single vect…

Since Android Studio 1.4, we can use Vector Assets which was earlier restricted to Lollipop alone. This is more efficient since one drawable which requires multiple instances saved in different density folders will now be replaced by just ONE single vector asset inside res/drawable/

You need to use Gradle 1.4 for this.

Add 'com.android.tools.build:gradle:1.4.0-beta3'to your build.gradlefile. (The stable version will be out in the coming weeks). Add a vector asset by right-clicking res/drawable/ > New > Vector Asset. Android Studio provides a built-in viewer for you to pick your drawable. Reference your icon like you usually do. Eg: android:icon="@drawable/ic_help_24dp"

NOTE:

Since the icons are black, you may want to tint your ActionBar icons white. You can do so by reference the icon like this: menu.getItem(index).getIcon()and then use DrawableCompat to tint.

扫一扫在手机打开

评论
已有0条评论
0/150
提交
热门评论
相关推荐
Get your hands on Android Studio 1.3,handsandroid
  • AndroidStudio
  • 2022-05-20 18:29
  • 8 0 0
+1
How to Use OpenCV in Android Studio,opencvandroid
  • AndroidStudio
  • 2022-05-20 18:29
  • 10 0 0
+1
Useful Android Studio Shortcuts
  • AndroidStudio
  • 2022-05-20 18:29
  • 5 0 0
+1
Android Studio tutorial for beginners
  • AndroidStudio
  • 2022-05-20 18:29
  • 10 0 0
+1
Android Studio: Simple webview setup
  • AndroidStudio
  • 2022-05-20 18:29
  • 6 0 0
+1
今日要闻
换一批
热点排行