EditText does not accept digits as input

262 views
Skip to first unread message

Etienne Lawlor

unread,
Aug 5, 2013, 8:06:54 PM8/5/13
to actionba...@googlegroups.com

The EditText view with id="price" has an inputType="numberDecimal" that does not accept any digits but will only accept one decimal point. The other EditText view with id="store" has noinputType set but has two issues. If the view has no input then entering a digit from the keyboard doesn't do anything. The only way to have a digit be accepted is if it immediately follows either a letter or another digit. I am using the default Android keyboard. The layout is being inflated in theonCreateView() method of a subclass of SherlockFragment. Could this be an issue with theEditText view behavior inside a SherlockFragment? Does anyone know what could be causing this issue?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent" 
              android:layout_height="match_parent" 
              android:orientation="vertical">
    <TextView 
        style="@style/ProductTextViewTitle"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:padding="10dp" 
        android:text="Product Tile" />
    <TableRow android:layout_width="fill_parent" 
              android:layout_height="50dp"     
              android:gravity="center_vertical"
              android:padding="5dp">
        <TextView 
              style="@style/ApolloStyleBold"
              android:layout_width="0dp" 
              android:layout_height="match_parent" 
              android:layout_weight="0.4"
              android:gravity="center_vertical" 
              android:paddingLeft="5dp" 
              android:text="@string/price"/>
        <EditText android:id="@+id/price" 
                  android:layout_width="0dp" 
                  android:layout_height="match_parent"
                  android:layout_weight="0.6" 
                  android:background="@null" 
                  android:hint="@string/price_italic_hint"
                  android:inputType="numberDecimal"/>
    </TableRow>
    <TableRow android:layout_width="fill_parent" 
              android:layout_height="50dp"    
              android:gravity="center_vertical"
              android:padding="5dp">
        <TextView   
            style="@style/ApolloStyleBold"
            android:layout_width="0dp" 
            android:layout_height="match_parent" 
            android:layout_weight="0.4"
            android:gravity="center_vertical" 
            android:paddingLeft="5dp" 
            android:text="@string/store_name"/>
        <EditText android:id="@+id/store" 
                  android:layout_width="0dp" 
                  android:layout_height="match_parent"
                  android:layout_weight="0.6" 
                  android:background="@null" 
                  android:hint="@string/stores_hint"
        />
    </TableRow>
</LinearLayout>

Jake Wharton

unread,
Aug 5, 2013, 8:08:42 PM8/5/13
to actionba...@googlegroups.com
SherlockFragment doesn't do anything except wrap and unwrap types. Any behavior change around this is not because of ABS.

--
You received this message because you are subscribed to the Google Groups "ActionBarSherlock" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionbarsherl...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Etienne Lawlor

unread,
Aug 5, 2013, 8:13:21 PM8/5/13
to actionba...@googlegroups.com

Etienne Lawlor

unread,
Aug 6, 2013, 1:39:40 AM8/6/13
to actionba...@googlegroups.com
Hey Jake,
  Thanks for clearing that up.  At least I know that ABS is not to blame.  I updated my Stackoverflow post, and realized that  

I have a similar layout that is used to inflate a subclass of 'SherlockFragmentActivity', and those 
EditText views behave normally.

 Do you have an idea of what I could look into for what could be causing this strange behavior?






--
You received this message because you are subscribed to a topic in the Google Groups "ActionBarSherlock" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/actionbarsherlock/74Z_17dgVsE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to actionbarsherl...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
-Etienne Lawlor (Software Developer)

Etienne Lawlor

unread,
Aug 7, 2013, 1:50:22 AM8/7/13
to actionba...@googlegroups.com
Does this have anything to do with different version of Android or different phone manufacturers.  Because I am seeing different behavior testing on two different phones 

Etienne Lawlor

unread,
Aug 22, 2013, 1:13:46 PM8/22/13
to actionba...@googlegroups.com
The issue was with a ViewGroup higher up in the ViewHierarchy that was consuming certain events like entering digits on a Keyboard.  http://stackoverflow.com/questions/18069507/edittext-does-not-accept-digits-as-input
Reply all
Reply to author
Forward
0 new messages