2012-01-04 2 views
3

Android에서는 고정 된보기를 다른보기 위에 놓을 수 있습니다. 예를 들어, 브라우저를 열고 검색 상자를 누르면 키보드 프롬프트가 나타납니다 (목록보기 상단). 그러나 키보드가 사라지지 않고도 목록보기에서 위아래로 스크롤 할 수 있습니다. 마찬가지로 :Android에서 오버레이보기가 작동하는 방식은 무엇입니까?

example showing keyboard overlaying the listview

사람이 작동하는 방법 (추가 양호하게는 일부 샘플 코드를) 설명해 주시겠습니까?

내가하려고하는 것은 목록 뷰 상단에 항상 부동 탐색 모음이 있으며 목록보기의 맨 아래에있는 사용자 지정 목록보기를 사용하는 것입니다 (실제로 목록보기의 머리글/바닥 글이 아니라, 화면의 머리글/바닥 글과 비슷합니다). 방금 설명한 예제와 비슷할 것입니다. 여기서 사용자는 탐색 모음과 탐색 모음의 "아래"목록보기와 상호 작용할 수 있습니다.

나는 안드로이드 개발에 다소 익숙하다. 그렇게한다면 좋을 것이고 약간의 세부 사항을 제공 할 것이다. :) 미리 감사드립니다 !!

답변

0

내가 생각할 수있는 간단한 선형 레이아웃을 사용하고, 그것을 달성하는 방법에는 여러 가지가 있습니다

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/header"> 
     //Here you add whatever you want in your "header" 
    </LinearLayout> 

    //create your listview 
    <ListView 
    android:id="@+id/content_list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:cacheColorHint="#00000000" 
    android:layout_marginRight="10dip" 
    android:layout_marginLeft="10dip" 
    android:layout_marginTop="10dip" 
    android:layout_marginBottom="10dip" 
    android:scrollbars="none" 
    android:paddingBottom="5dp" 
    /> 

    <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/footer"> 
     //Here you add whatever you want in your "footer" 
    </LinearLayout> 

+0

답장을 보내 주셔서 감사합니다. 특정 XML은 특정 화면에서 작동하는 것처럼 보이지만 사용자가 키보드를 닫을 때 작동하지 않습니다. 내 질문에이 지점을 명시하지 않았 음을 사과드립니다. 내 잘못. 내가 달성하려고하는 것은 실제로 두 개의 뷰를 서로 겹치게하여 하나의 뷰로 평면화하지 않는 것입니다.> 그 이유는 내 앱의 모든 뷰 위에 하나의 특정 오버레이 네비게이션 헤더 뷰를 작성해야하기 때문입니다. 내가보기를 오버레이하는 방법을 알고 있다면 이것을 할 수있는 쉬운 방법이 있었으면 좋겠다. –

관련 문제