Why Android is truncating my ActionBar title?

前端 未结 13 2053
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:04

    I know this question was posted a long time ago, but I recently ran into this issue and it caused a hell of a headache. I'm working on a Galaxy Note 10.1 and my title was "BidItems" and I only had the action overflow item visible, yet sometimes, "BidItems" became "BidIt..." which is just ridiculous. After much testing, I found that the reason for this truncating behavior in my application is that I was calling a method using ((MyActivity) getApplication()).setTitle(); method from one of my fragments. The setTitle() method in my Activity calls getActionBar().setTitle(). As soon as I called this method, my title was truncated for no reason. But simply calling setTitle() from my activity worked just fine.

    I really hope this saves people the headache it caused me.

提交回复
热议问题