Why Android is truncating my ActionBar title?

前端 未结 13 2055
Happy的楠姐
Happy的楠姐 2021-02-13 10:28

In my app, I change the title in the ActionBar from each fragment displayed. When I first start my apps, I got a list of requests, so my title is \"My requests (20)\".

T

13条回答
  •  囚心锁ツ
    2021-02-13 11:21

    I will add that you can totally use the action bar title on 2 lines to get more space:

    //Set the title over 2 lines if needed:
        int titleId = Resources.getSystem()
                .getIdentifier("action_bar_title", "id", "android");
        if (titleId > 0) {
            TextView title = (TextView) findViewById(titleId);
            title.setSingleLine(false);
            title.setMaxLines(2);
            //          title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        }
    

    I am using it on my application and I am happy with it :)

    Credit to this post

提交回复
热议问题