How I customize these Edittext that will be generated (backcground, Textcolor, fontsize, etc.)

Asked

Viewed 27 times

1

Does anyone know how I customize these edittext that will be generated (backcground, Textcolor, fontsize, etc.)

public class Main2Activity extends AppCompatActivity {

    private LinearLayout layout;
    private EditText[] vetorEdits;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        layout = (LinearLayout) findViewById(R.id.layout);

        int count = getIntent().getIntExtra("qtd", 0);
        vetorEdits = new EditText[count];


        for(int i=0; i<count; i++){

            vetorEdits[i] = new EditText(Main2Activity.this);
            vetorEdits[i].setHint("Periodo " + (i+1));


            layout.addView(vetorEdits[i], new ViewGroup.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));


        }

    }

}

1 answer

1

vetorEdits[i].setTextColor(Color.PINK);    
vetorEdits[i].setBackgroundColor(Color.PINK);    
vetorEdits[i].setTextSize(24);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.