0

有什么办法可以隐藏当前活动的主屏幕并在主屏幕底部显示另一个,然后让第二个像 android 中的子幻灯片菜单一样

像我附在这个问题上的图片之类的东西

对简短的描述感到抱歉,因为我不知道有什么更好的方式来描述它

在此处输入图像描述

非常感谢任何帮助。我几乎为之疯狂。

也对不起我的英语

4

1 回答 1

1

查看这个 gitHub 项目 AndroidSlidingUpPanel。它很容易添加和使用。您可以在屏幕中间设置一个锚点,以使用 setAnchroPoint() 设置面板可以向上滑动的高度。

https://github.com/umano/AndroidSlidingUpPanel

您的主要活动布局应如下所示

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" >

<com.sothree.slidinguppanel.SlidingUpPanelLayout
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"  >

    <include 
        android:id="@+id/main_layout"
        layout="@layout/main"/>

    <include 
        android:id="@+id/slidepanel_layout"
        layout="@layout/slide_up_layout"/>

</com.sothree.slidinguppanel.SlidingUpPanelLayout>    
</RelativeLayout>

@layout/main 是其中包含主要内容的 xml 文件,@layout/slide_up_layout 是另一个 xml 文件,其中包含列表视图和您希望在上拉面板中显示的其他内容。

主要的.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout 
    android:id="@+id/linlay_search_bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <Button 
        android:id="@+id/btn_create"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:enabled="false"
        android:text="Go"/>

</LinearLayout>
</RelativeLayout>

slide_up_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" >

<ListView 
    android:id="@+id/listview_event_news_feed" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/linlay_top_buttons"
    android:background="@color/white" />

</RelativeLayout>

SlidingPane的一些有用的功能

slidingPane.collapsePane() 
slidingPane.hidePane()     
slidingPane.showPane()      
slidingPane.setDragView(R.id.handle);
于 2013-10-24T13:48:21.313 回答