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

View 를 나누어서, 한쪽 한쪽에 리스트뷰를 넣어야 하는데 그 방법을 ㅠ 모르겠어요.

0 추천

 

안녕하세요.

 

제가 현재, 바로 아래의 사진과 같은 레이아웃을 만들기 위해서 고민을 하고 있는데,

Tab1 아래의 부분에 View부분을 양쪽으로 나눠서 한쪽 한쪽씩 리스트뷰를 넣을 생각인데 , 어떻게 제 소스에

서 바꾸어 주어야 할지 고민입니다 ㅠ .  <tab1의 컨텐츠 부분은 주석처리를 해 보았습니다>

주석의 내용은 눈에 띄게 아래와 같이 해놓았습니다.

<!-- 이부분 -->

 

 2번째 사진은 제가 현재까지 진행을 한 부분입니다.

ㅈ지역별과 특별관 아래 쪽에, 선호 영화관 부터 시작해서, 서울 인천/경기, 대전/충청/세종..

등등 일렬로 리스트뷰로 넣어야 할텐데 어떻게 넣어야할지 ㅠ ㅠ 도움좀 부탁드립니다.

리스트뷰 관련 예제들을 찾아보았는데 제가 만든 탭 호스트 소스에 어떻게 적용을 시켜야할지 어렵네요..

소스가 추가되는 부분은, 아래의 댓글부분에 이어서 달아보았습니다.

@@

 

 

[xml소스]

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_location"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="ex.real_project.Location">

    <RelativeLayout
        android:id="@+id/Location_Toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/Location_Date_and_Seat_Image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="3dp"
            android:layout_marginLeft="3dp"
            android:background="@drawable/before_image" />

        <TextView
            android:id="@+id/Location_TextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="영화관 선택"
            android:textSize="30dp"
            android:textStyle="bold"
            android:layout_marginTop="10dp"
            android:layout_centerHorizontal="true" />

        

   

공산당 (1,960 포인트) 님이 2016년 11월 3일 질문
공산당님이 2016년 11월 3일 수정
<Button
            android:id="@+id/Loation_Selection"
            android:layout_toRightOf="@+id/Location_TextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="선택완료"
            android:layout_marginLeft="60dp"
            />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/location_selection" />

    </RelativeLayout>

    <TabHost
        android:id="@+id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
            </TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >

                <ScrollView
                    android:id="@+id/tab1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >

                    <TableRow
                        android:id="@+id/tableRow1"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
                        <!-- 이부분 -->

                    </TableRow>

                </ScrollView>

                <ScrollView
                    android:id="@+id/tab2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >

                    <TableRow
                        android:id="@+id/tableRow2"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">


                    <Button
                        android:id="@+id/button2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="test2"
                        android:textAppearance="?android:attr/textAppearanceMedium" />

                    </TableRow>
                </ScrollView>
            </FrameLayout>
        </LinearLayout>
    </TabHost>



</LinearLayout>

1개의 답변

0 추천
 
채택된 답변
코드가..

어떤 사이트(책)보고 따라 작성하신지는 모르겠으나

일단, fill_parent.. -> match_parent로 다 바꾸세요(fill은 아주아주 옛날꺼..)

 

또 이부분쪽에 ScrollView랑 TableRow 있는 이유도 모르겠고..(ScrollView id가 tab인것도 이상)

ListView를 아에 한번도 안보셨다면, ListView도 점차 안쓰게 될테니 차라리

RecyclerView쪽을 보시는게 좋을듯 하구요..

 

위 레이아웃 자체가 한 3년전에 쓰던것 같은(TabHost도 진짜 오랜만이네요)..

최신 책 하나 사서 보시는것이..

 

나누는거 자체는 그냥

<LinearLayout>(horizontal)(width : match)

<RecyclerView>(또는 리스트뷰.. 추천하진 않지만) (width : 0dp, weight : 1)

<RecyclerView>(width : 0dp, weight : 1)

<LinearLayout>
익명사용자 님이 2016년 11월 3일 답변
공산당님이 2016년 11월 6일 채택됨
좋은정보 감사드립니다. 말씀하신대로 최신책으로 한번 사서 봐야겟습니다.
말씀 안해주셨으면, 정말 구닥다리같은 fill_parent 와 더불어, 많은 부분에서 애를 먹을뻔했습니다 ㅠ 보는이들로 하여금 얼마나 답답했을지 모르겠네요.


말씀하신 나누는 부분에 대해서 제가 많이 이해가 더딘편이여서 좀 더
상세하게 여쭤보고 싶습니다. 죄송합니다ㅠ

아래의 코드와 같이 말씀을 하셨는데, 첫번째  지역관과 특별관 부분은
리니어 레이아웃으로 구성된 <LinearLayout>(horizontal)(width : match)  로
만드는것이고,

왼쪽의 서울,인천/경기 부터 시작해서 제주까지 RecyclerView를 쓰고
우측의 강남,동대문부터 씨티(강남대로) 까지 또 하나의 ReCyclerView를
쓰는것이 맞나요?


<LinearLayout>(horizontal)(width : match)

 <RecyclerView>(또는 리스트뷰.. 추천하진 않지만) (width : 0dp, weight : 1)

 <RecyclerView>(width : 0dp, weight : 1)

 <LinearLayout>

그리고 더불어,  ScrollView랑 TableRow 관련해서 있는 이유는 제가 어떤 블로그

에서 게시한것을 토대로 만들어 보자는 마음에 가져다가 쓰게 되었는데, 일단 스

크롤뷰와 TableRow 같은 경우에는 지우고 나중에 추가해도 되니까 일단은 없애

고 위와 같은 사진을 만드는게 더 효과적일까요? 혹시나 고수님께서 보시기에

거슬리는게 있으시면 언제라도 아무거나 말씀해주시면 정말 감사드리겠습니다.
답변자는 아닙니다만..
저 리니어 안에 있는 부분들은 서울 및 강남 리스트 두개가 나오는 부분을 만드는데 쓰는거구요 위에 지역관 특별관은 따로 만들어주셔야되요, 물론 코드가 더 먼저 작성되어야겠지요?
지역관과 특별관 부분을 RecyclerView로 만들어야 한다는 말씀이신거 맞죠?
...