【发布时间】:2012-10-03 09:57:09
【问题描述】:
您好,我必须开发一个示例应用程序。在这里我希望选择应用程序名称为 Admin Login 并且重力为中心。在这里我必须运行该应用程序意味着应用程序名称已成功显示。但重力不适用于我。这里我想把应用名称对齐。我该怎么做。请给我解决方案。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidlogin.ws"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".AndroidLoginExampleActivity"
android:label="Admin Login" android:theme="@style/CustomTheme" android:gravity="center">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
编辑:
<style name="CustomWindowTitleBackground">
<item name="android:background">#093f7c</item>
<item name="android:gravity">center</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
【问题讨论】:
-
一个 Google 搜索给了我这个:stackoverflow.com/questions/8767655/… 似乎工作。
-
@Christiaan de Jong:这对我不起作用。所以问的问题
-
@user1676640 定义自己的风格并查看 ram kirans 评论
-
@Ramkiran 我在这里使用了以下代码: 这里背景颜色设置成功。但我的重力只剩下了。但我希望将重力设为中心。