小编sma*_*ong的帖子

如何在TextView中使冒号垂直居中

我有一个TextView展示时间.时间每秒更新一次.

我用过DIN字体.我已设置TextView为居中对齐(垂直).为什么结肠与基线对齐?谁知道如何解决这个问题?

在此输入图像描述


更新

               <TextView
                    android:id="@+id/time"
                    android:layout_width="wrap_content"
                    android:layout_height="48px"
                    android:layout_below="@id/temperature"
                    android:layout_centerHorizontal="true"
                    android:layout_marginBottom="-5px"
                    android:fontFamily="DIN"
                    android:gravity="center"
                    android:textColor="@color/white"
                    android:textSize="39px" />
Run Code Online (Sandbox Code Playgroud)

android textview

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

使用Struts2标签格式化数字

我想在jsp页面中格式化一些数字.
首先,我在我的porperties中定义了一些资源
format.number.with2Decimal={0,number,#0.00}

......
问题1:
我想知道'#'和'0'是什么意思?
0.00,#0.00,##.00,### 0.00
谁能告诉我它们之间的区别?谢谢!

问题2:
如果我在我的动作BigDecimal number1中定义一个BigDecimal类型;

然后我的页面应该使用一种格式来显示这个值,
1.if number1=null then show -NIL-
2.if number1=0 then show -NIL-
3.if number1>0 then show 1.00,3434.98 .....
请忽略数字<0

问题3:
将number1更改为String,
1.if number1=null or empty or blank then show -NIL-
2.if number1=Hello then show Hello ....

你能帮我个忙吗?

java format struts2 bigdecimal number-formatting

5
推荐指数
2
解决办法
7556
查看次数