【问题标题】:TextViews fill the available space but never clip the contentTextViews 填充可用空间但从不剪切​​内容
【发布时间】:2015-07-10 17:44:45
【问题描述】:

我有(水平)滚动视图和一些文本视图。我希望这些 textview 填充屏幕上的所有空间并均匀地划分它们之间的空间。有点像viewpagerstrip

但是,我意识到在某些语言中,我的字符串翻译比 textview 长并且会剪辑文本。有没有办法确保(单行)文本视图的内容永远不会被剪辑。

remaning textview 应该只是划分remaning 空间。如果没有足够的空间,我希望他们离开屏幕。

【问题讨论】:

  • @La5t5tarfighter 我不知道这一点。但是,textviews 的背景是不同的,所以除非它也溢出,否则我认为它不会起作用。
  • 你想让文本视图像字幕一样滚动吗?或者你只是不在乎你是否看不到整个事情?

标签: android layout localization textview


【解决方案1】:

在创建之前

    TextView ticker;

在创建时

 ticker = findViewById(R.id.ticker);

        ticker.setFocusable(true);
        ticker.requestFocus();
        ticker.setSelected(true);

这里是xml

<TextView
     android:id="@+id/ticker"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:layout_alignParentLeft="true"
     android:background="#fff000"
     android:ellipsize="marquee"
     android:fadingEdge="horizontal"
     android:fadingEdgeLength="5dp"
     android:focusable="false"
     android:gravity="bottom"
     android:lines="1"
     android:marqueeRepeatLimit="marquee_forever"
     android:singleLine="true"
     android:text="@string/ticker"
     android:textColor="#000000"
     android:textColorHighlight="#FFFFFF"
     android:textSize="30sp" />

【讨论】:

    猜你喜欢
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 1970-01-01
    • 2019-12-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多