Android: cannot enter edittext

I do not know why, but I cannot type / write in EditText when I try to do this. The EditText cursor is not displayed, and the keyboard, when displayed, is not numeric. I have the following piece of code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.android.asminhasdespesas.Meta_1Activity"> <TextView android:text="Test:" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TableRow> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:textColor="#000000" android:cursorVisible="true" android:ems="10" android:id="@+id/editTextMeta" android:layout_gravity="center_vertical" android:layout_weight="1" android:focusable="true" android:focusableInTouchMode="true" /> <TextView android:text="€" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow> <Button android:id="@+id/buttonNaoColocar" android:text="Cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="onClick"/> <Button android:id="@+id/buttonOk" android:text="Ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="onClick"/> </TableRow> </TableLayout> </LinearLayout> 

I tried to solve this situation using "android: cursorVisible =" true " or even " android: textColor = "# 000000" , I also tried "android : focusable =" true "android: focusableInTouchMode =" true "" , but the problem saved, I cannot type EditText.

Can you help me?

+7
android android-edittext
source share
4 answers

You probably want something like:

  <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:textColor="#000000" android:cursorVisible="true" android:ems="10" android:id="@+id/editTextMeta" android:layout_gravity="center_vertical" android:focusable="true" android:focusableInTouchMode="true" /> 
  • Remote weight (not used)
+2
source share

I am new to Android Development . Well, I ran into the same problem. So I just installed

 android:text="" 

this led to the appearance of the text when I typed it in EditText . I'm not sure why this work, but I'm just talking from personal experience.

+2
source share

As others have said, the code you have above looks like this will not cause a problem. It makes me think when you make an object in your java file (s), which you can embed with customization. I would write where the problem arises due to the elimination of a large number of tags from your edit text box and make it as minimal as possible, for example

  <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:id="@+id/editTextMeta" /> 
0
source share

Check if you have setOnKeyListener wherever you have edittext, and make sure you return false if you don't need an event, for example:

 OnKeyListener listener = new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { //Do something return true; } return false; } }; 
0
source share

All Articles