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

layout 관련 질문 드립니다

0 추천
LinearLayout 안에 두개의 Textview를 수평으로 두었습니다.

1번 textview 오른쪽으로  2번 textview가 항상 붙어 있어야 합니다.

1번 textview는 제목이 들어가서 길어질수도 있고 짧을수도 있어 width="WRAP_CONTENT"로 설정 해 놓았는데 내용이 길어지면 2번 textview가 밀려나서 보이질 않습니다.

RelativeLayout 으로 바꿔서 2번 textview를 1번 오른쪽에 배치해도 1번 내용이 길어지면 자꾸 밀려나서 화면에서 보이질 않네요..

어떻게 바꿔야 할까요?
SM21 (780 포인트) 님이 2015년 7월 29일 질문
만약 내용이 길어져서 안보이는 것을 고려하신다면 scrollview를 생각해보시는 건 어떨까요? 구글링 하시면 많이 나옵니다.

2개의 답변

0 추천
<LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="53dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="90dp"
            android:layout_height="46dp"
            android:text="TextView" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1" >

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="TextView" />

        </LinearLayout>

    </LinearLayout>

레이아웃 두개쓰기

NewApp (620 포인트) 님이 2015년 7월 30일 답변
0 추천

    <RelativeLayout

                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
 
                <TextView
                    android:id="@+id/text2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:text="텍스트2"
                    android:textSize="10dp" />
 
                <TextView
                    android:id="@+id/text1"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_toLeftOf="@+id/text2"
                    android:text="텍스트1"
                    android:textSize="10dp" />
            </RelativeLayout>
콜벳 (7,150 포인트) 님이 2015년 7월 30일 답변
...