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

이 문제를 도저히 풀다가 모르겠어서 질문을 합니다..

0 추천

 

안녕하세요 ..

안드로이드 관련해서.. 아래의 사진을 보고, 문제를 풀려고 하는데..

도저히 어떻게 풀지 모르겠어서 이렇게 질문을 올립니다 ㅠㅠ..

리니어 레이아웃만을 사용해서, 저렇게 만들어야 하는데..

도저히 아무리 4시간째 생각을 해봐도 해답이 떠오르질 않습니다 ㅠㅠ

도와주세요 ㅠㅠ

 

아래의 사진 첨부해봅니다 ㅠㅠ

 

 

Kind카인드 (3,600 포인트) 님이 2016년 10월 2일 질문

2개의 답변

+1 추천
 
채택된 답변
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#FF0000"/>

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#CCFF00"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#FFFFF0"
            android:id="@+id/textView" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#000000"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"   
            android:background="#FFFFFF"/>

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#0000FF"/>

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#66FF00"/>

    </LinearLayout>

</LinearLayout>

 

spark (227,910 포인트) 님이 2016년 10월 3일 답변
Kind카인드님이 2016년 10월 4일 채택됨
감사합니다감사합니다감사합니다
0 추천
.<LinearLayout> (orientation  - vertical)

    <LinearLayout> (horizontal)

       <TextView 2개>(빨,노)

     </LinearLayout>   

    <LinearLayout>(horizontal)

        <TextView 2개>(회,검)

     </Linearlayout>

     <LinearLayout>(horizontal)

        <TextView 3개>(흰,파,연)

      </LinearLayout>

   </LinearLayout>

 

간단하게 전체레이아웃 orientation을 vertical(세로)로 잡으세요, - orientation 모르시면 검색

그 다음에 세로 3줄이 있죠 그 각각 한줄씩 LinearLayout으로 나누세요(horizontal)

 

그리고 비율을 맞추려면 weight라는걸 써야되는데 이부분도 잘 모르시면 검색해보세요

맨 윗줄만 보자면

LinearLayout 가로를 match로 주고

TextView 2개인데 각각 weight 1씩 주면 화면 반반 꽉 차게 됩니다
익명사용자 님이 2016년 10월 2일 답변
음 ㅠㅠ 답변 정말 감사드립니다 ㅠ
아래의 수직방향으로 세줄은 만들었는데, 위쪽의 수평방향으로
만드는 부분에서 자꾸 애를 먹어서 어떻게 해야 할지 잘 모르겠어요 ㅠㅠㅠ 어언 4시간째인데 저 윗부분을 어떻게 만들어 주어야
할지 ㅠㅠ..
...