Segue código:
public class ListaActivity extends TabActivity implements OnClickListener {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lista);
TabSpec descritor = getTabHost().newTabSpec("tag1");
descritor.setContent(R.id.bebidas);
descritor.setIndicator("Bebidas", getResources().getDrawable(R.drawable.ico_bebidas));
getTabHost().addTab(descritor);
descritor = getTabHost().newTabSpec("tag2");
descritor.setContent(R.id.entradas);
descritor.setIndicator("Entradas", getResources().getDrawable(R.drawable.entradas));
getTabHost().addTab(descritor);
getTabHost().setCurrentTab(0);
}
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="10sp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</HorizontalScrollView>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/bebidas"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<TableLayout
android:id="@+id/entradas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="4dip"
android:stretchColumns="1" >
<TableRow>
<TextView android:text="prato.." />
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
manda o código.Maicon Strey
Novo Hamburgo - RS - Brasil
------------------
2012/6/7 Carlos Henrique Rodrigues <carloshenrique.br@gmail.com>Caros,
Estou tentando implementar uma telas com abas e em cada aba coloco o nome e defino um ícone para a mesma. Só que quando rodo a aplicação apenas a descrição da aba aparece e a imagem não. Tentei com imagens .jpeg e .png. Tem um limite de tamanho? Tenten com imagens de 1,2Kb e ainda assim não apareceu.
--
Cordialmente,
Carlos Henrique Rodrigues
Analista de Sistemas
@CHRSousa
--
Cordialmente,
Carlos Henrique Rodrigues
Analista de Sistemas
@CHRSousa






0 comentários:
Postar um comentário