Why Android is truncating my ActionBar title?

前端 未结 13 2106
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:14

    Your AndroidManifest.xml has your activity definition like so

    
    
    

    If you change android:label="Whatever" to android:label=" ",

    It'll work. I assume this happens because android creates a TextView to display label and the width is not re-sized when setTitle is called. So by setting the initial title to have more characters than you're going to set the title with, it will not be truncated.

提交回复
热议问题