Thứ Hai, 8 tháng 10, 2012

How can I force the Action Bar to be at the bottom in ICS?

It worked for me in this sample project. Here is the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.commonsware.android.actionbarbc"
          xmlns:android="http://schemas.android.com/apk/res/android">

  <application android:hardwareAccelerated="true"
               android:icon="@drawable/cw"
               android:label="@string/app_name">
    <activity android:label="@string/app_name"
              android:name=".InflationDemo"
              android:uiOptions="splitActionBarWhenNarrow">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="4"
            android:targetSdkVersion="11" />
  <supports-screens android:anyDensity="true"
                    android:largeScreens="true"
                    android:normalScreens="true"
                    android:smallScreens="true"
                    android:xlargeScreens="true" />
</manifest>

    Also, I noticed that on my Galaxy Nexus, which runs ICS, that the messaging application has the Action Bar the bottom and nothing but the title on the top, so it must be possible to somehow force the Action Bar to be at the bottom.

If you are referring to the conversation list, that is the ActionBar at the top and bottom, using splitActionBarWhenNarrow and the following setup code:

private void setupActionBar() {
    ActionBar actionBar = getActionBar();

    ViewGroup v = (ViewGroup)LayoutInflater.from(this)
        .inflate(R.layout.conversation_list_actionbar, null);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(v,
            new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,
                    ActionBar.LayoutParams.WRAP_CONTENT,
                    Gravity.CENTER_VERTICAL | Gravity.RIGHT));

    mUnreadConvCount = (TextView)v.findViewById(R.id.unread_conv_count);
}

Không có nhận xét nào:

Đăng nhận xét

Học lập trình web căn bản với PHP

Bài 1: Các kiến thức căn bản Part 1:  https://jimmyvan88.blogspot.com/2012/05/can-ban-lap-trinh-web-voi-php-bai-1-cac.html Part 2:  https://...