1
I have this layout in my app:
And I’m raising him like this:
TextView txtCategoria = (TextView)LayoutInflater.from(this).inflate(R.layout.text, null);
txtCategoria.setText(listenerCategoria.nome);
final ImageButton btCategoria = (ImageButton) LayoutInflater.from(this).inflate(R.layout.button, null);
btCategoria.setId((int) listenerCategoria.id);
btCategoria.setImageResource(getResources().getIdentifier(listenerCategoria.nome_foto, "drawable", getPackageName()));
Are separated into 3 LinearLayout
where I add so:
if(l==1){
layout1.addView(btCategoria);
layout1.addView(txtCategoria);
Log.e("l1","entrou "+txtCategoria.getText());
l=2;
}else if(l==2){
layout2.addView(btCategoria);
layout2.addView(txtCategoria);
Log.e("l2","entrou "+txtCategoria.getText());
l=3;
}else if(l==3){
layout3.addView(btCategoria);
layout3.addView(txtCategoria);
Log.e("l3","entrou "+txtCategoria.getText());
l=1;
}
What I want is: It is possible to center the text under the photo?
The configuration of text.xml
:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtCategoria"/>
Show what you have in
text.xml
.– Paulo Rodrigues
put there .... .
– Ilgner de Oliveira