标题栏上的启动画面

时间:2015-08-21 08:53:38

标签: android hide splash-screen titlebar

我想问一下是否有任何方法可以隐藏标题栏在启动画面页面上显示它? 我尝试通过设计页面更改主题

尝试了

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen


requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

但标题栏仍然存在,有什么方法可以隐藏它吗?

问候。

4 个答案:

答案 0 :(得分:1)

在setContentView(R.layout.test_activity)上面添加两行;

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();
    setContentView(R.layout.test_activity);

答案 1 :(得分:0)

设置android:theme =“@ android:style / Theme.NoTitleBar.Fullscreen” 在你的AndroidManifest.xml文件中,如bellow。

Dim Request As WebRequest
Dim Response As WebResponse
Dim DataStream As Stream
Dim Reader As StreamReader
Dim SoapByte() As Byte
Dim SoapStr As String
Dim pSuccess As Boolean = True

SoapStr = "<?xml version=""1.0"" encoding=""utf-8""?>"
SoapStr = SoapStr & "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">"
SoapStr = SoapStr & "<soapenv:Header/>"
SoapStr = SoapStr & "<soapenv:Body>"
SoapStr = SoapStr & "<ns:getAuth> <delisId>id</delisId> <password>pass</password> <messageLanguage>de_DE</messageLanguage> </ns:getAuth>"
SoapStr = SoapStr & "</soapenv:Body>"
SoapStr = SoapStr & "</soapenv:Envelope>"

Try
  SoapByte = System.Text.Encoding.UTF8.GetBytes(SoapStr)

  Request = WebRequest.Create("https://public-ws-stage.dpd.com/services/LoginService/V2_0/?wsdl")
  Request.Headers.Add("SOAPAction", "https://public-ws-stage.dpd.com/services/LoginService/V2_0/getAuth")

  Request.ContentType = "text/xml; charset=utf-8"
  Request.ContentLength = SoapByte.Length
  Request.Method = "POST"

  DataStream = Request.GetRequestStream()
  DataStream.Write(SoapByte, 0, SoapByte.Length)
  DataStream.Close()

  Response = Request.GetResponse()
  DataStream = Response.GetResponseStream()
  Reader = New StreamReader(DataStream)
  Dim SD2Request As String = Reader.ReadToEnd()

  DataStream.Close()
  Reader.Close()
  Response.Close()

Catch ex As WebException
  MsgBox(ex.ToString())
End Try

答案 2 :(得分:0)

真的很简单!只需在Activity类的“setContentView”之前添加此代码即可。     requestWindowFeature(Window.FEATURE_NO_TITLE);

enter image description here

此致 加布里埃尔

答案 3 :(得分:0)

对于AppCompat,以下解决方案为我工作:

styles.xml添加没有操作栏的新主题样式并设置parent="Theme.AppCompat.NoActionBar"

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimary</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowBackground">@color/colorPrimary</item>

</style>


现在为androidManifest.xml

中的启动画面活动实现相同的主题样式
<activity
        android:name=".ActivityName"
        android:theme="@style/SplashTheme"> // apply splash them here 

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

结果如下:

enter image description here