0
点赞
收藏
分享

微信扫一扫

自定义 Android toast 字体大小


让Android Toast 居中 可以设置 字体大小

Toast toast = Toast.makeText(this, "这是一个简单的自定义Toast", Toast.LENGTH_LONG);
                toast.setGravity(Gravity.CENTER, 0, 0); //居中显示
                LinearLayout linearLayout = (LinearLayout) toast.getView();
                TextView messageTextView = (TextView) linearLayout.getChildAt(0);
                messageTextView.setTextSize(25);//设置toast字体大小
                toast.show();


举报

相关推荐

0 条评论