1
J'essaye d'ajouter un ImageView dans un TableRow en Java, mais il montre toujours en blanc. L'image semble être là, mais elle est complètement blanche.Comment ajouter un ImageView à un TableRow dans le code
Voici mon code:
TableRow newRow = new TableRow(this);
newRow.setId(1);
LayoutParams lptr = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
newRow.setLayoutParams(lptr);
newRow.setBackgroundColor(this.getResources().getColor(R.color.white));
ImageView pImg = new ImageView(this);
pImg.setImageDrawable(this.getResources().getDrawable(R.drawable.error));
newRow.addView(pImg);
Pourquoi ça ne fonctionne pas?
Avez-vous ajouté la nouvelle ligne à la 'TableLayout '? – 2red13