EditText does not open the keyboard within the listView

2

A listView was created within a dialog and I placed in front of each information a EditText , but when I click on EditText to change the information it puts the cursor inside EditText , but not% open the keyboard so I can change the data.

Note: this editText is in a layout , I do not create it in adapter .

Follow the codes.

XML that loads the list:

<TableLayout
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:showDividers="middle"
    android:shrinkColumns="*"
    android:stretchColumns="*"
    android:layout_alignParentTop="true"
    android:layout_alignParentStart="true">

    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" >

        <TextView
            android:id="@+id/txtMateriais"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.40"
            android:gravity="center"
            android:padding="10dip"
            android:text="Lançamento de Materiais"
            android:textColor="@color/colorPreto"
            android:textSize="20sp"
            android:textStyle="bold"
            android:typeface="normal" />
    </TableRow>

    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center_horizontal">

        <TextView
            android:id="@+id/txtProduto"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="0.75"
            android:background="@drawable/shape_text_dialog"
            android:gravity="left"
            android:padding="10dip"
            android:text="Produto:"
            android:textColor="@color/colorPreto"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/txtProdutoDose"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="0.25"
            android:background="@drawable/shape_text_dialog"
            android:gravity="left"
            android:padding="10dp"
            android:textColor="@color/colorPreto"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/edtProdutoUsado"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="0.25"
            android:background="@drawable/shape_text_dialog"
            android:inputType="numberDecimal"
            android:windowSoftInputMode="adjustResize|stateHidden"
            android:padding="10dp" />


    </TableRow>

</TableLayout>

Adapter :

@SuppressLint({ "ViewHolder", "InflateParams" })
public class ListaMateriaisAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    private List<Materiais> listMateriais;
    private Context context;
    protected LinkedList<Materiais> material;

    public ListaMateriaisAdapter(Context context, List<Materiais> listMateriais)
    {
        this.listMateriais = listMateriais;
        this.context = context;
        mInflater = LayoutInflater.from(context);
    }

    public int getCount()
    {
        return listMateriais.size();
    }

    public Materiais getItem(int position)
    {
        return listMateriais.get(position);
    }

    public long getItemId(int position)
    {
        return position;
    }

    public Context getContext()
    {
        return this.context;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {

        final Materiais materiais = listMateriais.get(position);

        view = mInflater.inflate(R.layout.activity_lista_materiais, null);

        final MateriaisDAO materiaisDAO = new MateriaisDAO(this.getContext());

        //Produto
        TextView txtProduto = (TextView) view.findViewById(R.id.txtProduto);
        txtProduto.setText(String.valueOf(materiais.getDescricaoMaterial()));

        //Dose
        TextView txtProdutoDose = (TextView) view.findViewById(R.id.txtProdutoDose);
        txtProdutoDose.setText(String.valueOf(String.format("%.2f",(materiaisDAO.getQntRecomendada(materiais.getNumeroOrdem, materiais.getCodigoMaterial())))));

        //Quantidade Aplicada
        final EditText edtQntUsada = (EditText) view.findViewById(R.id.edtProdutoUsado);
        edtQntUsada.setText(String.valueOf(String.format("%.2f",((materiaisDAO.getQntRecomendada(materiais.getNumeroOrdem, materiais.getCodigoMaterial())) * LancamentoActivity.areaApl))));

        //------------------------------------------------------------------------------------------

        View convertView = view;

        view = convertView;

        return view;


    }
}

Dialog that loads the list:

private void dialogMateriais(){
        final View dialogView = inflater.inflate(R.layout.lista_materiais, null);

        android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(LancamentoActivity.this);
        dialog.setTitle("MATERIAIS");
        dialog.setView(dialogView);

        List<Materiais> listaMaterial = new ArrayList<Materiais>();
        MateriaisDAO materiaisDAO = new MateriaisDAO(LancamentoActivity.this);

        inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
        listView = (ListView) dialogView.findViewById(R.id.listMateriais);

        listMateriais = materiaisDAO.getMateriais(EntradaActivity.numeroOrdem);

        ListarMateriais = new ListaMateriaisAdapter(LancamentoActivity.this, listMateriais);

        listView.setAdapter(ListarMateriais);
        listView.setCacheColorHint(Color.TRANSPARENT);

        dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });

        dialog.setNegativeButton("CANCELAR", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });

        dialog.show();
    }
    
asked by anonymous 27.10.2017 / 15:07

0 answers