Reputation: 127
I have this xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/horizontalPadding"
android:paddingRight="@dimen/horizontalPadding"
android:paddingTop="@dimen/verticalPadding"
android:paddingBottom="@dimen/verticalPadding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="@dimen/padding" >
<TextView
android:text="@string/training_exercise_set_weight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/training_exercise_set_weight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberDecimal"
android:ems="10" />
</LinearLayout>
</LinearLayout>
When my app is running the keyboard is visible and clickable, but the value of editText doesn't change. how can i resolve it?
Upvotes: 0
Views: 3083
Reputation: 118
For me, the problem was, I didn't let my PopupWindow be focused. Then I found out that my PopupWindow focusable was by default set to false. So, I try to add 1 new parameter that explicitly tells the PopupWindow is focusable. You can see it in my screenshot below. Previously I didn't pass the false value, only the first three values.
Now, I can type anything in the EditText. This one took a whole day to be resolved. 🤣
Upvotes: 0
Reputation: 127
If someone is interesed, i resolved using the EditText.requestFocus()
Upvotes: 1
Reputation: 29285
android:ems="10"
is all about width of the view, however you are overriding this setting by layout_width
property setting to match_parent
.
It looks like you would want two EditText
s to be stretch equally and fill that LinearLayout
, so here you wouldn't need ems
at all. You would need maxLength
instead.
Also note that to stretch those EditText
s you should set their widths to 0dp
and set their weight to 1
(or something else. They should be equal).
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="@dimen/padding" >
<TextView
android:text="@string/training_exercise_set_weight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/training_exercise_set_weight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberDecimal"
android:maxLength="10" />
</LinearLayout>
Upvotes: 0
Reputation: 11185
Try to replace android:ems="10"
with android:maxEms="10"
or android:maxLength="10"
, I'm not sure, what you want to achieve with this parameter
Hope, this will solve you issue
Upvotes: 0