Android 在Nexus手机上向上滑动面板式库存拨号器

Android 在Nexus手机上向上滑动面板式库存拨号器,android,Android,在我的应用程序中,当用户单击联系人图标时,我希望在幻灯片中显示联系人信息,该幻灯片从底部显示,可以向上滑动以覆盖整个屏幕,也可以向下滑动以消失 我试着使用umano的SlideingUppanel,但我无法让它按照我的需要工作,因为它不是为这个而设计的 有没有这样的库?这在Android中被称为底部工作表。只需将视图用作协调器布局的子视图,即可创建自己的底部图纸 添加到你的应用程序build.gradle: dependencies{ compile 'com.android.supp

在我的应用程序中,当用户单击联系人图标时,我希望在幻灯片中显示联系人信息,该幻灯片从底部显示,可以向上滑动以覆盖整个屏幕,也可以向下滑动以消失

我试着使用umano的SlideingUppanel,但我无法让它按照我的需要工作,因为它不是为这个而设计的


有没有这样的库?

这在Android中被称为底部工作表。只需将视图用作协调器布局的子视图,即可创建自己的底部图纸

添加到你的应用程序build.gradle:

dependencies{
    compile 'com.android.support:design:24.1.1'
}
然后使用这些类创建您自己的:

这里是一个过于简化的演示,演示如何使FrameLayout充当底部工作表,您可以使用片段替换FrameLayout的内容,并根据需要向其传递信息。(在您的情况下,以点击的联系人为准):

布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.sample.bottomsheetsample.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:context="com.kdotj.bottomsheetsample.MainActivity"
        tools:showIn="@layout/activity_main">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!" />
    </RelativeLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

    <!-- Notice a few things: 
        app:layout_behavior="@string/bottom_sheet_behavior" required to act as bottom sheet
        app:behavior_peekHeight="244dp" this is the collapsed state height
        app:behavior_hideable="true" lets you swipe to dismiss the sheet
        android:elevation="@dimen/design_appbar_elevation" puts the sheet over the action bar
    -->
    <FrameLayout
        android:id="@+id/fl_bottomSheet"
        app:layout_behavior="@string/bottom_sheet_behavior"
        app:behavior_peekHeight="244dp"
        app:behavior_hideable="true"
        android:elevation="@dimen/design_appbar_elevation"
        android:background="#777"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.AppCompatTextView
            android:layout_gravity="center|top"
            android:text="Hello, Bottom Sheet!"
            android:padding="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>

这在Android中被称为底部表单。只需将视图用作协调器布局的子视图,即可创建自己的底部图纸

添加到你的应用程序build.gradle:

dependencies{
    compile 'com.android.support:design:24.1.1'
}
然后使用这些类创建您自己的:

这里是一个过于简化的演示,演示如何使FrameLayout充当底部工作表,您可以使用片段替换FrameLayout的内容,并根据需要向其传递信息。(在您的情况下,以点击的联系人为准):

布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.sample.bottomsheetsample.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:context="com.kdotj.bottomsheetsample.MainActivity"
        tools:showIn="@layout/activity_main">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!" />
    </RelativeLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

    <!-- Notice a few things: 
        app:layout_behavior="@string/bottom_sheet_behavior" required to act as bottom sheet
        app:behavior_peekHeight="244dp" this is the collapsed state height
        app:behavior_hideable="true" lets you swipe to dismiss the sheet
        android:elevation="@dimen/design_appbar_elevation" puts the sheet over the action bar
    -->
    <FrameLayout
        android:id="@+id/fl_bottomSheet"
        app:layout_behavior="@string/bottom_sheet_behavior"
        app:behavior_peekHeight="244dp"
        app:behavior_hideable="true"
        android:elevation="@dimen/design_appbar_elevation"
        android:background="#777"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.AppCompatTextView
            android:layout_gravity="center|top"
            android:text="Hello, Bottom Sheet!"
            android:padding="16dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>