ActionBar background image

后端 未结 5 1223
旧巷少年郎
旧巷少年郎 2020-11-29 20:41

I\'ve inherited the Holo Light Theme and customized the background of the ActionBar with the following:

Content of styles.xml



        
5条回答
  •  囚心锁ツ
    2020-11-29 20:50

    Ok, thanks to Romain Guy on #android-dev IRC channel, it's a known bug on honeycomb / Android 3.0 which will be fixed on the next release. Since then, the only solution is do it from code, and it works :-)

     final ActionBar actionBar = getActionBar(); 
     BitmapDrawable background = new BitmapDrawable (BitmapFactory.decodeResource(getResources(), R.raw.actionbar_background)); 
     background.setTileModeX(android.graphics.Shader.TileMode.REPEAT); 
     actionBar.setBackgroundDrawable(background);
    

提交回复
热议问题