У меня есть простой GridLayout
:Android GridLayout fill_horizontal выходит за пределы экрана
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:rowCount="1" >
<TextView
android:layout_column="0"
android:layout_row="0"
android:text="Label"/>
<EditText
android:inputType="text"
android:layout_column="1"
android:layout_row="0"
android:text="asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf"
android:layout_gravity="fill_horizontal"/>
</GridLayout>
Однако это приводит к тому, EditText
продлить с экрана, как можно увидеть ниже (изображение с IDE, но он делает то же самое, когда работает на устройстве).
Оказывается, что EditText
на самом деле полная ширина экрана, а не ширина GridLayout
клетки, поэтому он собирается за кадром. Что пошло не так в макете, чтобы вызвать это?
http://stackoverflow.com/questions/30845440/edittext-getting-out-of-gridlayout см. Это – KrishnaJ