Padding between ActionBar's home icon and title

前端 未结 21 1650
名媛妹妹
名媛妹妹 2020-11-28 20:03

Does anybody know how to set padding between the ActionBar\'s home icon and the title?

21条回答
  •  死守一世寂寞
    2020-11-28 20:37

    This is how I was able to set the padding between the home icon and the title.

    ImageView view = (ImageView)findViewById(android.R.id.home);
    view.setPadding(left, top, right, bottom);
    

    I couldn't find a way to customize this via the ActionBar xml styles though. That is, the following XML doesn't work:

    
    
    
    

    However, if you are looking to achieve this through xml, these two links might help you find a solution:

    https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml

    (This is the actual layout used to display the home icon in an action bar) https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/action_bar_home.xml

提交回复
热议问题