2010-12-21 2 views
0

다음과 같은 레이아웃이 있습니다. 내 문제는 작은 화면에서보기의 맨 아래에있는 단추가 사용자에게 보이지 않는다는 것입니다. ScrollView에서 전체 레이아웃을 감싸서 쉽게 해결할 수 있다고 생각했지만, 레이아웃에 ListView가 있기 때문에 이것이 실현 가능한 솔루션이 아니라는 것을 알게되었습니다.작은 화면의 레이아웃을 개선하는 방법에 대한 입력이 필요합니다.

이 레이아웃을 변경하는 방법에 대한 제안 사항은 무엇입니까? 내 주요 문제는 정말 ListView에 연결된 어댑터가 있고 레이아웃을 다시 실행하고 어댑터를 사용할 수 있는지 확실하지 않습니다. 누구를 생각해?

감사 다니엘은

BTW, here's 내 레이아웃 : 이러한 유형의 상황에 대한

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    style="@style/defaultBackground" 
    > 
    <LinearLayout 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:orientation="horizontal" 
     android:paddingBottom="10dip" 
     > 
     <TextView 
      android:id="@+id/roundInfo" 
      android:layout_width="wrap_content" 
      android:layout_height="20dip" android:textColor="#000" 
      /> 
     <TextView 
      android:id="@+id/balance" 
      android:layout_width="fill_parent" 
      android:layout_height="20dip" 
      android:gravity="right" 
      android:textColor="#000" 
      /> 
    </LinearLayout> 

    <ListView 
     android:id="@android:id/list" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:textSize="10sp" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:listSelector="@drawable/custom_row" 
     android:background="@drawable/custom_listview" 
     android:dividerHeight="0dip" 
     android:cacheColorHint="#FFFFFF" 
     android:fadingEdge="none" 
     android:divider="#FFFFFF" 
     /> 
    <TextView 
     android:id="@+id/gameCost" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/gameCost_not_finished" 
     android:textColor="#000" \ 
     android:paddingTop="10dip" 
     /> 
    <Button 
     android:id="@+id/update_button" 
     android:text="@string/placebet_button" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     style="@style/whiteText" 
     android:background="@drawable/custom_button" 
     /> 
</LinearLayout> 

답변

0

, 당신은있는 LinearLayout 대신 RelativeLayout의를 사용해야합니다. , 기본적으로

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    style="@style/defaultBackground" 
    > 
    <LinearLayout 
     android:id="@+id/header" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:layout_alignParentTop="true" 
     android:orientation="horizontal" 
     android:paddingBottom="10dip" 
     > 
     <TextView 
      android:id="@+id/roundInfo" 
      android:layout_width="wrap_content" 
      android:layout_height="20dip" android:textColor="#000" 
      /> 
     <TextView 
      android:id="@+id/balance" 
      android:layout_width="fill_parent" 
      android:layout_height="20dip" 
      android:gravity="right" 
      android:textColor="#000" 
      /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/footer" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:orientation="vertical" 
     > 
     <TextView 
      android:id="@+id/gameCost" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/gameCost_not_finished" 
      android:textColor="#000" 
      android:paddingTop="10dip" 
      /> 
     <Button 
      android:id="@+id/update_button" 
      android:text="@string/placebet_button" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      style="@style/whiteText" 
      android:background="@drawable/custom_button" 
      /> 
    </LinearLayout> 

    <ListView 
     android:id="@android:id/list" 
     android:layout_width="fill_parent" 
     android:textSize="10sp" 
     android:layout_height="fill_parent" 
     android:layout_above="@id/footer" 
     android:layout_below="@id/header" 
     android:listSelector="@drawable/custom_row" 
     android:background="@drawable/custom_listview" 
     android:dividerHeight="0dip" 
     android:cacheColorHint="#FFFFFF" 
     android:fadingEdge="none" 
     android:divider="#FFFFFF" 
     /> 
</RelativeLayout> 

을 RelativeLayout의에 루트 레이아웃을 변경하고, 세 가지 영역으로 콘텐츠를 구분 : : 이런 식으로 뭔가를 시도 머리글, 본문, 바닥 글. Header를 수평선의 LinearLayout 안에 그대로두고 alignParentTop으로 설정하십시오. wrap_content로만 설정되었으므로 가중치 또는 기타 항목에 대해 걱정할 필요가 없습니다. 그런 다음 바닥에 있어야하는 다른 고정 항목 (gameCost 텍스트 및 placeBet 버튼)을 바닥 글 역할을하는 수직 LinearLayout에 배치합니다. alignParentBottom으로 설정하십시오. 마지막으로, fill_parent 높이로 ListView를 선언하십시오. 나머지 공간이 필요하지만 머리말과 꼬리말 경계 내에서 유지하려면 layout_above 및 layout_below 매개 변수를 추가하십시오. 희망이 도움이!

+0

답장을 보내 주셔서 감사합니다. RelativeLayout 솔루션을 사용할 때 사용자가 ListView가 너무 작다고 생각하면 할 수있는 일이 있는지 궁금합니다. – Daniel

+0

화면에있는 다른 객체의 크기를 줄이거 나 (또는 ​​각 목록 항목을 더 작게 만드는 것) 이외에, 보유하고있는 데이터의 종류에 따라 목록을 별도의 활동으로 열거 나 스피너 만 사용하는 버튼이있을 수 있습니다 . – kcoppock

관련 문제