0

In my app I put an image as actionbar

getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.header_edea));

The code is right, but I need the sizes for the different densities (ldpi, hdpi, etc).

frogatto
  • 28,539
  • 11
  • 83
  • 129
benoffi7
  • 3,068
  • 3
  • 29
  • 44

2 Answers2

1

Check the following link:

Design layout to support multiple screen

on Android Studio, you can choose an image for different layout sizes.for example, you add that image on Project -> new -> ImageAsset and it will show you or it will create that image for different sizes with different directories.(you can see the results in different drawable folders or mipmap folder with different sizes).

enter image description here

And after that, you just have to choose it and it will fix that for different sizes.

Community
  • 1
  • 1
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
  • Mmmmm, sounds great. I will check! – benoffi7 Jan 12 '16 at 21:28
  • Also, there is a good plugin called: `Android Drawable Importer` you can try that also, i'd seen a problem/bug something like that with adding on android studio image asset, by the way you can try that too.;) – ʍѳђઽ૯ท Jan 12 '16 at 21:34
  • I have the height of the launcher icons but not the width of the action bar – benoffi7 Jan 12 '16 at 21:38
  • http://stackoverflow.com/questions/19921662/width-of-action-bar-android - http://stackoverflow.com/questions/7165830/what-is-the-size-of-actionbar-in-pixels perhaps these links will help you. – ʍѳђઽ૯ท Jan 12 '16 at 21:40
1

Android Studio has already a tool called Asset Studio described in LinX64.

For this purpose you can also check an online tool created by Roman Nurik called Android Asset Studio, which helps you to generate all needed image sizes: https://romannurik.github.io/AndroidAssetStudio/

Check this links - the first is a guide about creating icons, the second one give you information about all needed icon sizes for Android purposes like notifications or action bar:

Also on StackOverlow:

Hope it help

Community
  • 1
  • 1
piotrek1543
  • 19,130
  • 7
  • 81
  • 94