Android:如何在两个'视图'之间创建'SplitContainer'

时间:2013-07-15 12:20:10

标签: android google-maps android-layout android-gesture

enter image description here

根据截图我想实现以下ScreenUI(Android API> = 10):

您有GoogleMapsSupportFragementListView,它们共享视图的剩余高度(height是在应用程序启动时计算的,而应用程序仅在{{1}中运行})

PortraitMode容器的行为应该类似于Android-Notification菜单,因此用户可以滑入和滑出List,但是如果用户释放视图(触摸屏),动画就会启动。

到目前为止,我实施了两个ListViewLinearLayoutMap),它们除以红线(ListView)。我管理过,ListView在红线上单击显示/隐藏,但是如果我隐藏了ListView,它看起来很奇怪,因为地图被重绘并留下了黑色空间..

问题是:什么LinearLayout onTouchBehaviour`(类似于打开通知菜单)?

这是我的实施:

s best way to implement (LinearLayout? Fragments?)? Do you know examples for the

Layout.xml

//function is triggered at click on the redline-button
private void toggleOverlayList(){

    //TEST CASE API >= 11 

    int mListHeight = ((LinearLayout) findViewById(R.id.map_list)).getLayoutParams().height;
    Log.i(DEBUG,"toggleOverlayList() -> currentHeight:" + mListHeight );

    if(mListHeight == 0){
        ((LinearLayout) findViewById(R.id.map_wrapper)).getLayoutParams().height = mDisplayHeight;
        ((LinearLayout) findViewById(R.id.map_list)).getLayoutParams().height = mDisplayHeight;
        ((LinearLayout) findViewById(R.id.main_screen)).requestLayout();
    }
    else{
        ((LinearLayout) findViewById(R.id.map_wrapper)).getLayoutParams().height = 2* mDisplayHeight;
        ((LinearLayout) findViewById(R.id.map_list)).getLayoutParams().height = 0;
        ((LinearLayout) findViewById(R.id.main_screen)).requestLayout();
    }
}

1 个答案:

答案 0 :(得分:1)

您可以使用this库,而不是自己实现。 看看我对here的回答。希望它有所帮助。