2

我的清单中有一个活动定义为 android:theme="Theme.Sherlock.Dialog"。在此对话框的活动的 OnCreate 函数中,我设置了 requestWindowFeature(Window.FEATURE_NO_TITLE); 在 ICS 集上,这工作正常。我得到一个没有标题的对话框,但在 GingerBread 手机上,对话框的标题仍然出现,标题是蓝线,下面是我的内容。这是我正在做的

<activity
        android:name=".activity.PictureChooserDialog"
        android:configChanges="keyboardHidden|orientation"
        android:label="Set a Picture To Upload"
        android:launchMode="singleTop"
        android:theme="@style/ThemeWithCorners" />


<style name="ThemeWithCorners" parent="Theme.Sherlock.Dialog">
    <item name="android:windowBackground">@drawable/dialog_round_corners</item>
    <item name="android:windowCloseOnTouchOutside">false</item>
</style>


public class PictureChooserDialog extends SherlockActivity {

protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.dialog_picture_chooser_layout);

    //The dialog content

    ((Button) findViewById(R.id.cancelDialog))
            .setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View arg0) {
                    finish();

                }
            });

}

private class CustomClickListener implements ClickListener {

    public void onClick(final int index) {
        switch (index) {
        case 0:
            break;
        case 1:
            break;
        case 2:
            break;
        case 3:
            break;
        }

    }

}
}
4

1 回答 1

5

阅读https://github.com/JakeWharton/ActionBarSherlock/issues/500上的帖子。不得不将 android.view.Window 更改为 com.actionbarsherlock.view.Window。setWindowFeature 然后工作。

于 2012-10-01T09:25:38.433 回答