How can we increase the font size in toast?

前端 未结 7 605
谎友^
谎友^ 2021-01-31 15:15

Is there any way to increase the font size in toast without customizing?

I don\'t want to create a layout for increasing the text size.

Is there any way?

7条回答
  •  佛祖请我去吃肉
    2021-01-31 15:54

    this is ...

     Toast toast = Toast.makeText(context, R.string.yummyToast, Toast.LENGTH_SHORT);
    //the default toast view group is a relativelayout
    RelativeLayout toastLayout = (RelativeLayout) toast.getView();
    TextView toastTV = (TextView) toastLayout.getChildAt(0);
    toastTV.setTextSize(30);
    toast.show();
    

提交回复
热议问题