am new to android apps am making an app Which has NFc technology,here i want to make a Notification bar like default OS statusbar Notification. i made it custom now i want it to be call/display in all Screen while end user pull it from top to bottom within the app.
this is my custom Sliding drawer class and am using it in 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>
You should google it up, there are quite a few samples with good explanation, like these:
you should use oops for that
first make a BaseActivity which extends android.app.Activity. Now this will be the parent Activity for all of your app's Activities where you want to display status bar. Define all the function related to custom status bar in that and a parent layout for holding views related to child Ativity
xml layout for BaseActivity will be 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>
generate accesser method to access the slidingdrawer and parentLayout.
now your activities in which you want to add customSlidingBar should extends from BaseActivity in this way you only have to code once for sliding drawer implemation
hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.