2011-05-12 2 views
0

은 내가 abc.xml 및 텍스트 뷰의 ID 라벨 내 abc.xml 파일에서가진 문제는, 복수의 상대 레이아웃

this.setListAdapter(new ArrayAdapter<String>(this, R.layout.abc,R.id.label, days)); 

나는 상대가 추가됩니다 배열 문자열이 생성되고있다 레이아웃을 사용하여 탐색 표시 줄을 한 번만 표시합니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#4C4646" 
    > 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/RelativeLayout02" android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#3E3D3D" 
    android:paddingRight="3dp" 
    android:paddingLeft="3dp" 
    > 
    <Button android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:id="@+id/back_listing" 
     android:background="@drawable/android_back_button" 
     android:layout_marginTop="6dp"> 
     </Button> 

<TextView android:id="@+id/search_label" 
    android:layout_width="fill_parent" 
    android:layout_height="45dp" 
    android:layout_toRightOf="@+id/back_listing" 
    android:layout_toLeftOf="@+id/search_submit" 
    android:textSize="20px" 
      android:text="Nav Bar" 
    android:layout_marginTop="7dp" 
    android:layout_marginLeft="45dp" 
    android:layout_gravity="right" 
    android:textStyle="bold"/> 
    /> 


<Button android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:id="@+id/search_submit" 
    android:layout_alignParentRight="true" 
    android:background="@drawable/android_forward_button" 
    android:layout_marginTop="6dp" 

    > 
</Button> 
</RelativeLayout> 

어레이리스트

하지만이 문제로 텍스트 뷰 채워

다음

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="10px" 
android:textSize="15px" 
android:id="@+id/label" 
> 
는 탐색 바 이어 가기로 나타내고있다 내 배열 목록의 첫 번째 항목에 의해 탐색 막대가 다시 따라 간 다음 두 번째 항목 내 배열 목록에서 다음 탐색 모음에서,이 배열 목록의 끝까지 발생합니다. 또한 마치 navbar가 내 arraylist와 루프에 있습니다. 이제 상대 레이아웃 (navbar)의 내용을 벗어나서 textview를 떠날 때, 그것은 완벽하게 보이지만 당연히 나는 ontop을 보여주는 nav bar를 원합니다.

답변

0

는이 작업을 분리해서해야 다른 xml 파일에

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="10px" 
android:textSize="15px" 
android:id="@+id/label" 
> 

아마도 그런 row.xml를 호출하여 어댑터와 해당 파일을 사용합니다. 상단에 탐색 모음을 표시하려면 기본 레이아웃에서 alignParentTop = true로 설정하고 아래에 ListView를 놓습니다. android:layout_below="@+id/navBarLayout"

관련 문제