Khi sử dụng fill_parent
, maxWidth
không có hiệu lực.maxWidth không hoạt động với fill_parent
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxWidth="50dip"/>
</LinearLayout>
</LinearLayout>
Cảm ơn bạn! Làm thế nào để điền vào EditText của tôi tất cả chiều rộng của màn hình nhưng không nore 500dip? Ví dụ một số màn hình có độ phân giải <500. –
Điều này có vẻ ngớ ngẩn nhưng nó hoạt động: thêm 'minWidth' và đặt cả" min "và" max "thành' 500dp'. – Sam
@Sam - điều này dường như không hoạt động đối với tôi, editText vẫn lấp đầy toàn bộ màn hình ngoại trừ lề. Bạn có thể xây dựng? – katzenhut