Toast设置字体大小

    private Toast mToast;
 
	private void showTip(final String str) {
		runOnUiThread(new Runnable() {
			@Override
			public void run() {
				if (mToast == null) {
					mToast = Toast.makeText(getApplicationContext(), "",
							Toast.LENGTH_LONG);

                    //key parameter
					LinearLayout layout = (LinearLayout) mToast.getView();
					TextView tv = (TextView) layout.getChildAt(0);
					tv.setTextSize(25);
                    //
				}
				//mToast.cancel();
				mToast.setGravity(Gravity.CENTER, 0, 0);
				mToast.setText(str);
				mToast.show();
			}
		});
	}

猜你喜欢

转载自blog.csdn.net/grandgrandpa/article/details/83093637
今日推荐