在我的水平LinearLayout中,我有一個TextEdit和一個ImageButton。 ImageButton和TextEdit一樣高。ImageButton:Force square icon(height = WRAP_CONTENT,width =?)
我希望ImageButton和它一樣寬。
在它看起來像的ImageButton的寬度的時刻是當沒有縮放(ImageButton的寬度[像素] =未縮放可繪製寬度[像素]),如:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/txtName"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton
android:id="@+id/btSet"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scaleType="fitEnd"
android:src="@drawable/pin2" />
</LinearLayout>
如何它應該看起來像:
只是有點尖。將layout_weight設置爲視圖時,渲染速度更快,以將寬度設置爲0dp。 – 2012-04-06 14:18:31
@BananaNutTruffles:謝謝!我不知道那件事。 – SecStone 2012-04-06 14:25:28
您是否找到解決方案? – rekire 2012-11-16 14:13:25