2013年8月20日 星期二

action bar overlay


設定action bar overlay ( themes.xml)


<resources>

    <style name="FitMiTheme" parent="@android:style/Theme.Holo">
          <item name="android:windowActionBarOverlay">true</item>
    </style>


設定UI在action bar之後

從XML

<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
   android:paddingTop="?android:attr/actionBarSize" >

從Java


                   TypedValue tv = new TypedValue();
   this.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
   int actionBarHeight = getResources().getDimensionPixelSize(tv.resourceId);
   layoutParams.setMargins(0, actionBarHeight, 0, 0);

沒有留言:

張貼留言