Custom Notification Bar in Android

2019-06-13 13:23发布

For my android application my requirement is to implement the Custom Notification Bar in my layout. When user drag this Custom notification bar then icons will be visible. This custom notification bar is look like notification bar at the bottom in the Facebook Android Application. If anyone knows how to do this then please share with me.

1条回答
迷人小祖宗
2楼-- · 2019-06-13 13:53

You can use SlidingDrawer.

For example:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello"/>

    <SlidingDrawer
        android:id="@+id/slidingDrawer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"

        android:handle="@+id/handle"
        android:content="@+id/content">

        <Button
            android:id="@id/handle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Drawer Handle"/>

        <TextView
            android:id="@id/content"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@color/grey"
            android:text="This is the content of the drawer"/>

    </SlidingDrawer>

</FrameLayout>

Update:

Nice tutorial with detailed description: Android: Damn that Sliding Drawer

查看更多
登录 后发表回答