Skip to content Skip to sidebar Skip to footer

Edittext ,entered Text Not Visible Full

A sample code where i need to have a Edit Text in a Grid Layout Programatically .But when the text are entered in the app ,Only the small bottom portion of text is visible .The tex

Solution 1:

try setting param.height = 50; to WRAP_CONTENT

// Create EditText
    for(int i = 0 ; i< 10 ; i++)
    {
        rowIndex     = i ;
        EditText editText = new EditText(this);
        GridLayout.LayoutParams param = new GridLayout.LayoutParams();
        param.height = WRAP_CONTENT;
        param.width = 250 ;// GridLayout.LayoutParams.MATCH_PARENT;
        param.rowSpec = GridLayout.spec(rowIndex);
        param.columnSpec = GridLayout.spec(0);

        param.setMargins(0,5,0,0);

        editText.setTextColor(R.color.colorPrimaryDark);
        editText.setTextSize(10);
        editText.setBackgroundColor(0xFFFFFFFF);
        editText.setLayoutParams(param);
        if (rowIndex == 1) {
            editText.setId( R.id.task1);
        }
        if (rowIndex == 2) {
           editText.setId(R.id.task2);
        }

        //editText.setHeight(30);
       // editText.setWidth(180);
       // editText.setBackgroundColor(R.color.colorAccent);
        Glyout.addView(editText);
        rowIndex++;
    }

Post a Comment for "Edittext ,entered Text Not Visible Full"