【问题标题】:Remove Title Bar Phonegap删除标题栏Phonegap
【发布时间】:2014-02-19 14:54:50
【问题描述】:

如何删除在 phonegap 构建中的应用程序开始时显示一秒钟左右的标题栏? 我尝试了全屏,如Phonegap remove title bar at start 所示,它的工作,应用程序是全屏的,但标题栏在应用程序开始时仍然显示一秒钟左右。 在本地构建时,我可以使用命令 android:theme="@android:style/Theme.NoTitleBar">

删除标题栏表单 manifest.xml

如何从 phonegap build 中完全删除标题栏?

我通过将这些行添加到 config.xml 来解决它

<gap:config-file platform="android" parent="/manifest">

       <supports-screens 
              android:xlargeScreens="false" 
              android:largeScreens="false" 
              android:smallScreens="false" />
        <application android:theme="@android:style/Theme.NoTitleBar" >
            <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ></activity>
        </application>
</gap:config-file>

【问题讨论】:

  • 拜托!有人可以分享他对此的想法吗?我相信每个人都有这个问题,我在网上搜索了几个小时没有成功......这个问题解决了吗?还是一般?
  • 我也面临同样的问题!有没有办法解决这个问题??
  • 我添加了 [gap:config-file platform="android" parent="/manifest"] [application android:theme="@android:style/Theme.NoTitleBar" ] [activity android:theme ="@android:style/Theme.NoTitleBar.Fullscreen" ][/activity] [/application] [/gap:config-file] 到我的 config.xml -> 小部件部分,但它不起作用。和以前一样!请问有人可以分享一下吗?

标签: cordova phonegap-plugins phonegap-build cordova-3


【解决方案1】:

Alex 已经在第一篇文章中提供了解决方案。我想澄清两点:

  1. 您不必禁用对某些屏幕尺寸的支持即可使其正常工作。请注意,我已将supports-screens 的属性改回true
  2. 您还需要提供一个 android 命名空间,否则 PhoneGap Build 会报错“格式错误的 config.xml”(请参阅​​下面的粗体行)

这就是你的 config.xml:

<widget xmlns = "http://www.w3.org/ns/widgets" 
    xmlns:gap = "http://phonegap.com/ns/1.0"

xmlns:android = "http://schemas.android.com/apk/res/android"

    id        = "com.domain.app"
    version   = "1.0.0">

    ...

    <gap:config-file platform="android" parent="/manifest">
        <supports-screens 
            android:xlargeScreens="true" 
            android:largeScreens="true" 
            android:smallScreens="true" />
        <application android:theme="@android:style/Theme.NoTitleBar" >
            <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
            </activity>
        </application>
    </gap:config-file>
</widget>

向 Wildabeast 致敬on github

【讨论】:

  • 谢谢!我建议像 jbelfore 说的那样删除全屏元素。对我来说,一个大问题是当我拥有它并点击屏幕底部的输入字段时,键盘不再显示在输入下方,并且您看不到您输入的内容。
  • 本主题中的最佳答案!解决 phonegap 构建标题问题
【解决方案2】:

我使用了 robro 的代码,它可以工作,但我屏幕上的所有内容都在顶部被截断,因为我允许在我的配置中使用此设置的状态栏:

<preference name="fullscreen" value="false" />

然后我拿出了以下内容:

<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ></activity>

现在一切看起来都很完美。

【讨论】:

    【解决方案3】:

    尝试添加启动画面(如果您还没有)我试过了,但您再也看不到标题栏了。

    您的 config.xml 需要这些用于 Android:

    <icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
    <icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
    <icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
    <icon src="icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />
    

    然后将图像添加到 src。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-24
      • 2012-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-24
      相关资源
      最近更新 更多