Android API级别11+之后的ActionBarSherlock中的进度对话框未对齐;

Android API级别11+之后的ActionBarSherlock中的进度对话框未对齐;,android,themes,actionbarsherlock,progressdialog,Android,Themes,Actionbarsherlock,Progressdialog,在我的项目中,我添加了库ActionBar Sherlock,并为我的项目创建了自定义主题 我已经从中创建了自定义主题。 但在应用“未对齐”中的“我的进度”对话框主题后(表示未显示在屏幕中央) 请不要在API 11级或更高级别中出现此问题。 这里我附上了运行OS 4.2.2的emulator的屏幕截图 我无法解决这个问题 屏幕截图:: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://s

在我的项目中,我添加了库ActionBar Sherlock,并为我的项目创建了自定义主题

我已经从中创建了自定义主题。 但在应用“未对齐”中的“我的进度”对话框主题后(表示未显示在屏幕中央)

请不要在API 11级或更高级别中出现此问题。
这里我附上了运行OS 4.2.2的emulator的屏幕截图

我无法解决这个问题

屏幕截图::

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.testproject"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Custom_ThemeSherlockLight" >
        <activity
            android:name="com.example.testproject.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

MyCustomTheme::(值文件夹)

progress.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="130dp"
    android:layout_height="80dp"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:orientation="vertical" >

    <ProgressBar
        android:id="@+id/progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dip"
        android:gravity="center"
        android:text="Please wait.."
        android:textColor="@color/black" />

</LinearLayout>

请在中更改以下代码行

progress.xml文件

它现在应该显示在屏幕中央

希望这有帮助


编辑:请将TextView的布局宽度属性更改为“包装内容”。

我不知道这是否有用。但要解决“请稍候”文本的裁剪问题。将布局宽度更改为“包裹内容”,如下所示

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dip"
    android:gravity="center"
    android:text="Please wait.."
    android:textColor="@color/black" />


Bingo!!!!!!!解决了的。。。但如果我在应用您的更改后运行,那么文本视图只显示一半(而不是显示“请等待…”,它只显示“请”)。我已经在运行Android 4.0.4的设备上对其进行了测试,我可以看到完整的文本“请等待…”。让我知道您的测试环境。请将TextView的layout\u width属性更改为“wrap\u content”。它应该会起作用。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="130dp"
    android:layout_height="80dp"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:orientation="vertical" >

    <ProgressBar
        android:id="@+id/progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dip"
        android:gravity="center"
        android:text="Please wait.."
        android:textColor="@color/black" />

</LinearLayout>
android:layout_width="130dp"
android:layout_height="80dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dip"
    android:gravity="center"
    android:text="Please wait.."
    android:textColor="@color/black" />