在Android中举杯中心文 [英] Center text in a toast in Android

查看:112
本文介绍了在Android中举杯中心文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想,如果有一种方式来显示举杯所有文本为中心。举例来说,我有一个烤面包已在其2行文字。对于纯粹的审美原因,我想文本居中对齐,而不是左对齐。我已经通过的文​​件看,找不到任何关于它。有一个简单的方法来做到这一点,我已经错过了?

I was wondering if there was a way to display all text in a toast to be centered. For instance, I have a toast that has 2 lines of text in it. For purely aesthetic reasons, I would like the text to center-aligned instead of left-aligned. I've looked through the documentation and can't find anything about it. Is there a simple way to do this that I have missed?

谢谢 克里斯

推荐答案

使用的吐司的的setView(视图)功能提供与Gravity.CENTER视图

Use the Toast's setView(view) function to supply a View with Gravity.CENTER

这篇关于在Android中举杯中心文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆