Skip to content

Instantly share code, notes, and snippets.

@akbarsha03
Created February 18, 2014 07:51
Show Gist options
  • Save akbarsha03/9066390 to your computer and use it in GitHub Desktop.
Save akbarsha03/9066390 to your computer and use it in GitHub Desktop.
Set height for Tab in TabHost
public class TipoDisp
{
public static int alt_tabs(Context cont)
{
int alt;
int dx, dy;
DisplayMetrics metrics = cont.getResources().getDisplayMetrics();
dx = metrics.widthPixels;
dy = metrics.heightPixels;
if (dx < dy)
alt = dy/15;
else
alt = dy/10;
return alt;
}
}
// and then, in the activity use something like this
int alt = TipoDisp.alt_tabs(myactivity.this);
mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = alt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment