在 activity 中禁用 "App name" 作为对话框工作
Disable "App name" in activity working as dialog
我将 activity 作为对话框。他的任务是显示生物认证提示。问题是每次都显示 "AppName" (WSZIBMobile)。
他的屏幕
screen_with_showed_dialog
我在 styles.xml 中创建了自己的样式并尝试在中隐藏该名称
onCreate 函数
requestWindowFeature(Window.FEATURE_NO_TITLE)
actionBar?.hide()
styles.xml
<style name="mytheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
<item name = "android:windowContentOverlay" >@null</item >
<item name = "android:colorBackgroundCacheHint" >@null</item >
<item name = "android:gravity" >bottom</item >
<item name = "android:backgroundDimEnabled">true</item>
<item name="android:windowFrame">@null</item>
</style>
SmallBiometric.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="wrap_content"
android:layout_gravity="bottom"
android:excludeFromRecents="true"
android:foregroundGravity="bottom"
tools:context=".Fragments.SmallBiometricAuth">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/rounded_corners"
android:foregroundGravity="bottom"
android:gravity="bottom"
android:orientation="vertical"
android:paddingTop="15dp">
<ImageView
android:id="@+id/finger_print_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="#ffffff"
android:src="@drawable/ic_fingerprint_black" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Zidentyfikuj się"
android:textAlignment="center"
android:textColor="#111111"
android:textSize="15sp" />
<TextView
android:id="@+id/cancel_auth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:text="Anuluj"
android:textAlignment="center"
android:textColor="#0055A5"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
androidManifest.xml
<activity android:name=".Fragments.SmallBiometricAuth" android:theme="@style/mytheme" />
两者都没有 work.Please 帮助 ;)
@编辑
非常感谢@Sanket Bhat
删除 "android" 命名空间帮助
我发现您正在使用 Theme.AppCompat.Light.Dialog
,因此请从您的主题中删除 android:
命名空间。
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
原因: android:
命名空间用于来自 Android SDK 的属性,并且由于 AppCompat 是一个支持库,您可以使用 app:
命名空间或声明它没有命名空间
我将 activity 作为对话框。他的任务是显示生物认证提示。问题是每次都显示 "AppName" (WSZIBMobile)。 他的屏幕 screen_with_showed_dialog
我在 styles.xml 中创建了自己的样式并尝试在中隐藏该名称 onCreate 函数
requestWindowFeature(Window.FEATURE_NO_TITLE)
actionBar?.hide()
styles.xml
<style name="mytheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
<item name = "android:windowContentOverlay" >@null</item >
<item name = "android:colorBackgroundCacheHint" >@null</item >
<item name = "android:gravity" >bottom</item >
<item name = "android:backgroundDimEnabled">true</item>
<item name="android:windowFrame">@null</item>
</style>
SmallBiometric.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="wrap_content"
android:layout_gravity="bottom"
android:excludeFromRecents="true"
android:foregroundGravity="bottom"
tools:context=".Fragments.SmallBiometricAuth">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/rounded_corners"
android:foregroundGravity="bottom"
android:gravity="bottom"
android:orientation="vertical"
android:paddingTop="15dp">
<ImageView
android:id="@+id/finger_print_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="#ffffff"
android:src="@drawable/ic_fingerprint_black" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Zidentyfikuj się"
android:textAlignment="center"
android:textColor="#111111"
android:textSize="15sp" />
<TextView
android:id="@+id/cancel_auth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:text="Anuluj"
android:textAlignment="center"
android:textColor="#0055A5"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
androidManifest.xml
<activity android:name=".Fragments.SmallBiometricAuth" android:theme="@style/mytheme" />
两者都没有 work.Please 帮助 ;)
@编辑
非常感谢@Sanket Bhat 删除 "android" 命名空间帮助
我发现您正在使用 Theme.AppCompat.Light.Dialog
,因此请从您的主题中删除 android:
命名空间。
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
原因: android:
命名空间用于来自 Android SDK 的属性,并且由于 AppCompat 是一个支持库,您可以使用 app:
命名空间或声明它没有命名空间