#java #android #android-studio #fullscreen
#java #Android #android-studio #полноэкранный режим
Вопрос:
Все! Я пытаюсь сделать так, чтобы моя заставка полностью заполняла весь экран, используя приведенный ниже код:
В styles.xml файл:
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EBanking" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="ColdFullscreen" parent="Theme.EBanking">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/splash_background</item>
</style>
в Manifest.xml файл:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.themirrorcode.ebanking">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.EBanking">
<activity android:name=".MainActivity"
android:theme="@style/ColdFullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
activity_layout.xml код:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"/>
Фон приложения не полноэкранный, пожалуйста, смотрите картинку.
Спасибо!
Результат приложения
Редактировать
Хотите, чтобы изображение занимало весь экран.Что упоминается в приведенной выше ссылке
Ответ №1:
Измените эту строку
<style name="Theme.EBanking" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
к этому
<style name="Theme.EBanking" parent="Theme.MaterialComponents.DayNight.NoActionBar">
после этого добавьте
android:background="@drawable/splash_background"
чтобы activity_layout.xml
и удалить android:theme="@style/ColdFullscreen"
из вашего Manifest.xml файл
Комментарии:
1. добавьте весь код вашего Manifest.xml файл и код макета в вашем приложении к вашему вопросу
2. Я отредактировал свой вопрос так, как вам нужно. Спасибо за ваши комментарии.
3. я отредактировал свой ответ, не забудьте также изменить на
NoActionBar
4. Никаких изменений, когда я скрываю ActionBar и TitleBar. пожалуйста, смотрите прикрепленную картинку в моем вопросе выше.