在XML布局错误,无法转换为尺寸:15转换为、布局、尺寸、错误

由网友(不囍勿扰)分享简介:在我的应用程序在图形布局,显示了作为一个错误:Within my application I have an error in the graphical layout which shows up as:error!UnsupportedOperationException: Can't convert to...

在我的应用程序在图形布局,显示了作为一个错误:

Within my application I have an error in the graphical layout which shows up as:

error!
UnsupportedOperationException: Can't convert to dimension: 15
Exception details are logged in Window > Show View > Error LogThe following classes could not be found:
- TextView

当我运行应用程序工作的,但它显示在图形布局错误,没有人知道这个原因。

When I run the application this works, but it shows the error in the graphical layout, does anyone know the cause of this.

它发生时,我把安卓layout_marginTop = - 3dip,如果我不使用 - 那么这不显示。

It occurs when I put android:layout_marginTop="-3dip" , if I dont use - then this doesn't show.

感谢

推荐答案

有没有这样的东西作为一个负面的保证金。 使用安卓重力=顶如果你的TextView的比你TEXTSIZE高,您希望文本显示在顶部。否则,使用安卓layout_height =WRAP_CONTENT。您的观点将完全适合这种方式。

There is no such thing as a negative margin. Use android:gravity="top" if your textview is higher than your textsize and you want the text to appear on the top. Otherwise use android:layout_height="wrap_content". Your view will exactly fit this way.

如果您希望TextView的顶部边框和实际文本之间3DP空间, 使用的android:paddingTop =3DP。一般来说,保证金认为外面的自由空间,填充的边框和内容之间的内部间距。

If you want 3dp space between the top border of the textview and the actual text, use android:paddingTop="3dp". Generally, margin is the free space outside the view, padding is the inside spacing between the border and the content.

阅读全文

相关推荐

最新文章