In my code I long click some tab to start some activity, the background of the view becomes yellow by default. When I return from the started activity the background of the tab still stays as it is. What should I use to get rid of the yellow background?? And the tab is not long clickable but the view of each tab is long clickable.. this is my code. What should I write before return statement to remove that yellow colour??
tabHost.getTabWidget().getChildAt(1).setOnLongClickListener(new OnLongClickListener(){
@Override
public boolean onLongClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent(getApplicationContext(),LongActivity.class);
startActivity(i);
//what should i write here??
return true;
}
});
You can’t return anything from
onLongClickthat affects the color. The tab color is generally controlled by a state list drawable (see http://developer.android.com/resources/tutorials/views/hello-tabwidget.html, item number 3 for the basic detail).I believe what you would have to do is provide your own custom state list drawable that doesn’t use the yellow color. You may also need to refresh the screen somehow: I’ve honestly never seen tabs use
onLongClickbefore, so you may have hit some weird state.