1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public void onTitleClick(View v)
{
int id = v.getId();
switch (id) {
case R.id.MenuAndPriceTitle:
this.menuAndPriceShown = onToggleLayout(v,R.id.MenuAndPrice,this.menuAndPriceShown);
break;
case R.id.InformationTitle:
this.infoShown = onToggleLayout(v,R.id.Information,this.infoShown );
break;
}
}
public boolean onToggleLayout(View titleView, int layoutId, boolean prevState)
{
boolean newState = !prevState;
int iconId = titleView.getImageLeft();
titleView.set??????(iconId,0,newState?R.drawable.bar_icon_open:R.drawable.bar_icon_closed);
titleView.setBackground(newState?R.drawable.bar_back_open:R.drawable.bar_back_closed);
View layout = getView(layoutId);
layout.setVisibility(newState?View.VISIBLE:View.GONE);
return newState;
} |
Partager