I have this layout in my application:
AndI'mcreatingitlikethis:
TextViewtxtCategoria=(TextView)LayoutInflater.from(this).inflate(R.layout.text,null);txtCategoria.setText(listenerCategoria.nome);finalImageButtonbtCategoria=(ImageButton)LayoutInflater.from(this).inflate(R.layout.button,null);btCategoria.setId((int)listenerCategoria.id);btCategoria.setImageResource(getResources().getIdentifier(listenerCategoria.nome_foto,"drawable", getPackageName()));
They are separated by 3% with% where I add this:
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'm wanting is: Is it possible to center the text underneath the photo?
The setting of LinearLayout
:
<?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"/>