Вопрос

I have Relative layout to which i want to set width 1.4dp

How to do that.. If any have any idea please help.

Thanks in advance...!

Это было полезно?

Решение

you can only give integer values to layout parameters

source : http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html

No matter what the layout is you can never give a float value.

“dip” or “dp” or “dps” - Density-independent Pixels my friend which means you can't divide a fraction into another fraction.

pixels = dps * (density / 160).

For example, on 240 dpi screen, 1 dp would equal 1.5 physical pixels.

Другие советы

According to this reference you can use decimal places for views:

android:layout_height and android:layout_width - May be a dimension value, which is a floating point number appended with a unit such as "14.5sp".

http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#attr_android:layout_height

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top