How to use a CustomSliding box, for example, status notification in an Android application

I am new to Android applications that make an application that has NFc technology, here I want to create a notification bar, such as a notification about the OS status by default. I made it normal, now I want it to be a call / display on the whole screen, while the end user pulls it from top to bottom in the application.

this is my custom class Sliding drawer and use it in the Main.xml file

<com.abc.xyx.customnotification.CustomDrawer xmlns:my="http://schemas.android.com/apk/res/com.abc.xyx.app" android:id="@+id/drawer" my:direction="topToBottom" android:layout_width="fill_parent" android:layout_height="wrap_content" my:handle="@+id/handle" my:content="@+id/content" android:layout_marginTop="100dp" > <include android:id="@id/content" layout="@layout/slider"/> <ImageView android:id="@id/handle" android:layout_width="wrap_content" android:layout_height="150px" android:visibility="invisible" android:src="@drawable/tooltiparea" /> </com.abc.xyx.customnotification.CustomDrawer> 
0
source share
2 answers

You have to do this, there are many examples with a good explanation, for example:

0
source

you should use oops for this

first create a BaseActivity that extends android.app.Activity. Now it will be parental activity for all your applications. Actions in which you want to display the status bar. Define the entire function associated with the custom status bar and the parent layout to host the views associated with the child Ativity

xml layout for BaseActivity will look like this

  <com.abc.xyx.customnotification.CustomDrawer xmlns:my="http://schemas.android.com/apk/res/com.abc.xyx.app" android:id="@+id/drawer" my:direction="topToBottom" android:layout_width="fill_parent" android:layout_height="wrap_content" my:handle="@+id/handle" my:content="@+id/content" android:layout_marginTop="100dp" > <include android:id="@id/content" layout="@layout/slider"/> <ImageView android:id="@id/handle" android:layout_width="wrap_content" android:layout_height="150px" android:visibility="invisible" android:src="@drawable/tooltiparea" /> </com.abc.xyx.customnotification.CustomDrawer> <RelativeLayout > this layout is used for holding child Activities views </RelativeLayout> 

create an access method to access the sliding frame and parentLayout.

now your actions to which you want to add customSlidingBar should be continued from BaseActivity so that you only need to copy the code once to deploy the drawer

hope this helps

0
source

Source: https://habr.com/ru/post/915881/


All Articles