Я разрабатываю приложение для Android для проекта, над которым я работаю.
Я реализовал функционал и начал разрабатывать макеты. Я столкнулся с проблемой, которую не могу найти или найти решение в Интернете. Мой макет ограничения имеет белую полосу вверху по неизвестной причине.
Я попытался преобразовать макет в линейный, но полоса все еще там. Я пропустил что-то действительно очевидное или это ошибка?
<?xml version = "1.0" encoding = "utf-8"?>
<android.support.constraint.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"
android:background = "@drawable/gradient"
tools:context = ".Login">
<EditText
android:id = "@+id/registerEmailField"
android:layout_width = "371dp"
android:layout_height = "40dp"
android:layout_marginTop = "8dp"
android:layout_marginBottom = "8dp"
android:background = "@drawable/rounded_white"
android:ems = "10"
android:hint = "@string/email"
android:importantForAutofill = "no"
android:inputType = "textEmailAddress"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
app:layout_constraintVertical_bias = "0.469"
tools:targetApi = "o" />
<EditText
android:id = "@+id/loginPasswordField"
android:layout_width = "371dp"
android:layout_height = "43dp"
android:autofillHints = ""
android:background = "@drawable/rounded_white"
android:ems = "10"
android:hint = "@string/password"
android:inputType = "textPassword"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
app:layout_constraintVertical_bias = "0.561"
tools:targetApi = "o" />
<ImageView
android:id = "@+id/PicShare"
android:layout_width = "196dp"
android:layout_height = "67dp"
android:layout_marginTop = "8dp"
android:layout_marginBottom = "8dp"
android:contentDescription = "@string/the_picshare_logo"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintHorizontal_bias = "0.497"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
app:layout_constraintVertical_bias = "0.348"
app:srcCompat = "@drawable/pic_share" />
<Button
android:id = "@+id/loginButton"
android:layout_width = "371dp"
android:layout_height = "45dp"
android:background = "@drawable/rounded_blue"
android:text = "@string/login"
android:textColor = "#FFFFFF"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
app:layout_constraintVertical_bias = "0.665" />
<Button
android:id = "@+id/navigate_to_register"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:background = "@android:color/transparent"
android:text = "@string/not_registered_sign_up"
android:textColor = "#FFFFFF"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintHorizontal_bias = "0.497"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
app:layout_constraintVertical_bias = "0.752" />
<resources>
<!-- Base application theme. -->
<style name = "AppTheme" parent = "Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name = "colorPrimary">@color/colorPrimary</item>
<item name = "colorPrimaryDark">@color/colorPrimaryDark</item>
<item name = "colorAccent">@color/colorAccent</item>
</style>
<style name = "NoActionBar" parent = "Theme.AppCompat.Light.NoActionBar">
<item name = "windowActionBar">false</item>
<item name = "windowNoTitle">true</item>
<item name = "android:windowNoTitle">true</item>
<item name = "android:statusBarColor">@android:color/transparent</item>
</style>
Вы должны проверить атрибуты своей темы в values/styles.xml, вы можете установить свою тему так Theme.Black.NoTitleBar.Fullscreen. Или вы можете установить атрибут title следующим образом <item name = "android:windowNoTitle">true</item>
в ваших стилях.xml
<style name = "Theme.AppCompat.Light.NoActionBar.FullScreen" parent = "@style/Theme.AppCompat.Light.NoActionBar">
<item name = "android:windowNoTitle">true</item>
<item name = "android:windowActionBar">false</item>
<item name = "android:windowFullscreen">true</item>
<item name = "android:windowContentOverlay">@null</item>
</style>
в вашем manifest.xml
<activity
android:name = ".YourActivity"
android:theme = "@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
Блестящий, лучший ответ. Очень ценю это. На самом деле не знал, что делать с Google, но это решило эту проблему. Я отметил это как ответ.
Спасибо, я пробовал это. Хотя не совсем уверен, где его установить. Я добавил свой файл стилей выше.