HoneyComb平板电脑应用中底部标签栏的最佳布局设计

时间:2012-06-27 07:30:19

标签: android android-layout android-3.0-honeycomb

我想在HoneyComb Tablet的底部设计Tab Bar。那么,是否有任何特定的方法或栏可用于设计底部标签栏的布局?

2 个答案:

答案 0 :(得分:1)

只需在Android中使用默认的TabHosts并添加属性

即可 TabWidget

android:layout_alignParentBottom="true"

请参阅以下链接以获取更多信息

  1. How to align your TabHost at the bottom of the screen
  2. Android: Tabs at the BOTTOM

答案 1 :(得分:0)

绘制iphone类型标签栏

我通常在LinearLayout Horizo​​ntal中使用TextView和Background Gardients。

TextView具有可绘制的顶级属性,可以帮助包含图标。

我不建议使用默认标签布局

public void setFooterStyle(Context c,TextView profile,TextView parking,TextView taxi,TextView history,TextView help,int flag)
{   
    if(flag==0)
    {
        profile.setBackgroundResource(R.drawable.grey_background_gradient);
        profile.setTextColor(Color.rgb(255, 255, 255));
        profile.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.profile1, 0, 0);
    }
    else if(flag==1)
    {
        parking.setBackgroundResource(R.drawable.grey_background_gradient);
        parking.setTextColor(Color.rgb(255, 255, 255));
    }
    else if(flag==2)
    {
        taxi.setBackgroundResource(R.drawable.grey_background_gradient);
        taxi.setTextColor(Color.rgb(255, 255, 255));
        taxi.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.taxi_on, 0, 0);
    }
    else if(flag==3)
    {
        history.setBackgroundResource(R.drawable.grey_background_gradient);
        history.setTextColor(Color.rgb(255, 255, 255));
        history.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.history_on, 0, 0);
    }

在您的活动中

Global.getInstance().setFooterStyle(getApplicationContext(),(TextView) findViewById(R.id.btnprofile),(TextView)findViewById(R.id.btnparking),(TextView)findViewById(R.id.btntaxi),(TextView) findViewById(R.id.btnhistory),(TextView) findViewById(R.id.btnhelp), 4);