我想用戶的ImageView像機器人:layout_height = 「0.5dp」 將是錯誤
<ImageView
android:layout_width="match_parent"
android:layout_height="0.4dp"
android:background="@color/bottomline" />
但機器人:layout_height = 「0.4dp」是錯誤!
錯誤:可疑大小:這將使視圖不可見,應與layout_weight一起使用。
而且我發現,如果ImageView的是LinearLayout中的第一個視圖,這樣
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/backgroundcolor"
android:orientation="vertical" >
<!-- first view error -->
<ImageView
android:layout_width="match_parent"
android:layout_height="0.4dp"
android:layout_marginTop="10dp"
android:background="@color/bottomline" />
<!-- second view right -->
<ImageView
android:layout_width="match_parent"
android:layout_height="0.4dp"
android:layout_marginTop="10dp"
android:background="@color/bottomline" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="10dp"
android:text="李文"
android:textColor="@color/black_text_color"
android:textSize="16sp" />
如何解決這個問題就會出現錯誤?
你確定你想你觀點寬?它甚至不是像素 – webo80
錯誤清楚地表明。這0.4dp是非常小,你無法看到。添加高度,例如10dp你的錯誤將消失 – Amsheer
錯誤清楚地說明最新的問題在那一行。所以,給出最小的'1dp'爲高度。 – Yugesh