小编Ras*_*dul的帖子

如何在Horizo​​ntalScrollView中拟合TextView文本

好吧,如果文字太大,我会在TextView里面HorizontalScrollView滚动文字.但不幸的是,文本没有正确对齐 - 如果文本很大,则会留下很多文本.

布局:

  <HorizontalScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TextView
            android:id="@+id/retBal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:lines="1"
            android:scrollHorizontally="true"
            android:singleLine="true"
            android:text="Amount is being processed.."
            android:textColor="@color/_2ndGray"
            android:textSize="17sp"
            android:textStyle="bold" />
    </HorizontalScrollView>
Run Code Online (Sandbox Code Playgroud)

在活动类中:

TextView txtVwRetBal = (TextView)findViewById(R.id.retBal);

txtVwRetBal.setText("Balance is xyz11111111122222222222222333333333444444444555555555666666666677777777788888pqr"); 
Run Code Online (Sandbox Code Playgroud)

怎么解决?

android textview horizontalscrollview

1
推荐指数
1
解决办法
974
查看次数

如何将"Friday-2015-August-07"转换为"2015-08-07"

好吧,我很奇怪我尝试将字符串"Friday-2015-August-07"格式化为"2015-08-07"作为字符串但失败了.

有人可以帮我转换吗?输入,输出都应该是String.

所以,它应该是:

from:: String str_input = "Friday-2015-August-07";
to::  String str_output = "2015-08-07";
Run Code Online (Sandbox Code Playgroud)

或者甚至从下面的输入,因为我已经拆分str_input并使其如下所示:

from:: String str_input = "2015-August-07";
Run Code Online (Sandbox Code Playgroud)

但是第一个"2015年5月 - 8月-07"更适合输入.

java android

-2
推荐指数
1
解决办法
106
查看次数

标签 统计

android ×2

horizontalscrollview ×1

java ×1

textview ×1