Search code examples
kotlinandroid-activityandroid-dialog

Disable "App name" in activity working as dialog


I made activity as dialog. His mission is to show biometric authentication prompt. Problem is that every time is showing "AppName" (WSZIBMobile). He's screen screen_with_showed_dialog

I made own style in styles.xml and try to hide that name in onCreate function by

    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" />

Both doesn't work.Please help ;)

@EDIT

Thank you very much @Sanket Bhat Delete "android" namespace help


Solution

  • I observe that you are using Theme.AppCompat.Light.Dialog, so please remove android: namespace from your theme.

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    

    Reason: android: namespace is used for attribute coming from Android SDK and since AppCompat is a support library you can use app: namespace or declare it with no namespace