2014-12-14 6 views
0

LinearLayout이 꽤 길기 때문에 ListView가 아래의 레이아웃과 겹치기 때문에 ListView 아래에 LinearLayout을 가지고있다. 나는 여러 가지 방법을 시도했다. 때로는 미리보기에서는 좋지만 에뮬레이터에서는 잘 보이지 않았다. 실행 시간. 이것은 지금까지의 간단한 레이아웃입니다 (몇 가지 다른 것들이 있습니다, 그것도 잘 작동하지 않습니다). 임씨는이 가난한 문제에 집착하기 위해 화를 내고 있습니다. 누구든지 제 퍼즐을 풀 수 있습니까?안드로이드리스트 뷰 겹치기

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

<LinearLayout 
    android:id="@+id/footer" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center"> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:onClick="send" 
     android:text="@string/odeslat" /> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:onClick="reset" 
     android:text="@string/reset" /> 
</LinearLayout> 

<RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_above="@id/footer"> 

    <ListView 
     android:id="@+id/questionlst" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 
</RelativeLayout> 
</RelativeLayout> 

답변

0

는 당신은 당신의 바닥 글 LinearLayoutandroid:layout_alignParentBottom="true"를 추가 할 필요가 있었다. 그게 다야!

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

<LinearLayout 
    android:id="@+id/footer" 
    android:layout_alignParentBottom="true" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center"> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:onClick="send" 
     android:text="hey" /> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:onClick="reset" 
     android:text="hey" /> 
</LinearLayout> 

<ListView 
    android:id="@+id/questionlst" 
    android:layout_above="@id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
은 그냥 확인, 안드로이드 스튜디오에서 작동 : 당신이 뭔가를 얻을.

+0

나에게 적합하지 않은 기기 - 실제 기기 또는 에뮬레이터로 사용해 보셨습니까? Im은 genymotion을 사용하고 배포 할 때 동일한 문제가 있습니다. – Martin

+0

어떻게 생겼습니까? 스크린 샷을 업로드 할 수 있습니까? –

+0

할 수 있지만 볼 항목이 없습니다. 항목이 가득 찬 화면 전체에 listview 만 있습니다. 안드로이드 미리보기 괜찮아요,하지만 에뮬레이터 (당신은 AVD를 사용할 수 있습니다, 동일한 결과 여야합니다), 그리고 지금 당장은 그것을 테스트하기에 적합한 안드로이드 하드웨어를 가지고 있지 않습니다. – Martin