마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ImageView를 맨 뒤로 보내기 질문

0 추천
제가 ListView의 List Item을 Custom해서 Adapter를 사용하고 있습니다.

List Item에는 Layout안에 이미지와 텍스트만 들어가있죠. Layout은 배경색을 설정하였습니다.

 

ListView가 있는 xml에서 ImageView(이하 Target)를 넣었는데 그놈이 ListView뒤로 가게끔 배치를 시켰습니다.

근데 Adapter를 통한 List Item들이 삽입 되면 Target이 맨 뒤로 가게끔 배치를 시켰음에도 불구하고

삽입된 Item 위로 올라오게 되네요. 웃긴건 Item의 이미지와 텍스트보다는 뒤에 있습니다 ㅡㅡ

 

그니깐 지금 상황이 이렇습니다.

Item의 Layout보다는 위에 있고, Item의 이미지와 텍스트보다는 뒤에 있는거죠.

아예 위에 있으려면 위에 있고 뒤에 있으려면 뒤에 있어야지. 이건 대체 어떻게 된건지.....

 

서론이 길었습니다. 그래서 질문입니다.

저 Target을 그냥 무조건 맨 뒤로 보내버리고 싶은데 어떻게 안됩니까?

 

ps. Target이 있는 xml은 RelativeLayout을 이용해서 겹치기를 이용, 일단 뒤로 보내는데에는 성공했습니다.

근데 Custom List Item이 삽입 되면서 저 상황이 된 것입니다.
익명사용자 님이 2014년 12월 5일 질문

1개의 답변

0 추천
XML코드를 봤으면 합니다.
한드로이등 (810 포인트) 님이 2014년 12월 5일 답변
<?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"
    android:background="@color/blackWhite"
    android:keepScreenOn="true" >

....생략

<ImageView
        android:id="@+id/rotateImg"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_centerInParent="true"
        android:contentDescription="@string/app_name"
        android:src="@drawable/e_icon_512" />

    <ListView
        android:id="@+id/bt_search_listView"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/SearchTitleBar"
        android:divider="@color/blackWhite"
        android:dividerHeight="0px" >
    </ListView>

</RelativeLayout>

----------------------------------------
여기까지가 Target이 있는 xml입니다.

그리고 이 밑에는 Custom List Item xml입니다.

<?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" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="3dp"
        android:background="@drawable/transparent_roundcorner"
        android:padding="5dp" >

       ... 생략

        <ImageView
                    android:id="@+id/searchListViewCommit"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="center_vertical"
                    android:layout_rowSpan="2"
                    android:scaleType="fitCenter" />
         <Space
                    android:layout_width="10dp"
                    android:layout_height="wrap_content"
                    android:layout_rowSpan="2" />

                <TextView
                    android:id="@+id/searchListViewName"
                    android:layout_gravity="fill" />

   .. ...생략
         </RelativeLayout>
</RelativeLayout>
...