P
P
Pyjamec2011-04-21 21:16:09
Java
Pyjamec, 2011-04-21 21:16:09

Changing icons in tabs (Android)?

The question is this: I want to change the tab icon (Android TabHost), when I click on the tab or when I hover focus.
I wrote selectors, googled, the solution is obvious through selectors, I wrote, added icons, added drawable, but nothing happens, the icons do not change. Who faced similar?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Pyjamec, 2011-04-21
@Pyjamec

Believe it or not, only these and a couple of dozen more tutorials did not help. Did everything as there and does not work. Unfortunately, the code still works...

E
ertaquo, 2011-04-21
@ertaquo

Here are a couple of tutorials on this topic:
developer.android.com/resources/tutorials/views/hello-tabwidget.html
It says that you can use several drawables for a tab, for different states (state-list drawable).

P
Pyjamec, 2011-04-22
@Pyjamec

android_menu_button.xml: MainActivity.java: Resources res = getResources(); tabRecipeTabSpec.setIndicator("",res.getDrawable(R.drawable.android_menu_button) ).setContent(new Intent(this,RecipeTab.class)); recipe_tab_menu_.png, recipe_tab_menu.png files are in drawable-hdpi. What could be the problem?
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/recipe_tab_menu_"
android:state_selected="true"
android:state_pressed="false"
android:color="#ffffff"/>
<item android:drawable="@drawable/recipe_tab_menu" />

L
lavel, 2011-04-22
@lavel

image
I recommend looking at code.google.com/p/android-custom-tabs/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question