【问题标题】:Fit the text to the textview (with height = "fill_parent") by editting the xml file通过编辑 xml 文件使文本适合 textview (with height = "fill_parent")
【发布时间】:2013-02-02 14:25:10
【问题描述】:

我有一个在我的 xml 文件中定义的文本视图。我想让文本视图中的文本适合文本视图。我已将 textview 的高度设置为“fill_parent”(我不能使用“wrap_content”,因为我想保持 textview 适合其父布局)。另外我想将文本对齐到 textview 的右侧(我为此使用了重力属性,但不起作用。)。我应该在 xml 文件中添加哪些代码行来拟合文本和对齐文本。

【问题讨论】:

  • 你试过android:layout-weight=0
  • @jjpp - 如果有帮助,请接受或投票。

标签: android xml text textview


【解决方案1】:

为右对齐添加此项

android:gravity="right"
android:textAlignment="gravity"

至于填充整个屏幕,据我所知并搜索过,没有这样的命令。不过,您可以为它制作自己的功能。继续以编程方式增加文本并设置滚动视图并查看滚动条是否已进入视图,一旦出现,将文本大小设置为小于调用滚动条的值。

它似乎有缺陷,但它有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-08
    • 1970-01-01
    • 1970-01-01
    • 2011-06-26
    • 1970-01-01
    • 1970-01-01
    • 2016-08-10
    相关资源
    最近更新 更多