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

LinearyLayout 질문입니다.

0 추천

우와 같은 인터페이스를 작성하려고 하는데요,

인터페이스 xml 코드를 아래와 같이 작성하였어요,

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.hbinno.onpay.LoginActivity"
    android:background="@color/background">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:orientation="vertical"
            android:weightSum="100">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0px"
                android:background="#DD00DD"
                android:layout_weight="50" />

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0px"
                android:layout_weight="10"
                android:src="@drawable/image_first" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="10" />

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0px"
                android:layout_weight="10"
                android:src="@drawable/image_second" />
        </LinearLayout>
    </ScrollView>

</FrameLayout>

그런데 실행결과가 아래와 같이 나오더라구요,

빈 LinearyLayout 태그는 자기 height를 못가지는가요?

고수님들 부탁드립니다.

Love96 (170 포인트) 님이 2017년 4월 19일 질문
우선 weightSum이 100이면 그안의 오브젝트들이 다 합해서 100이 되여야겠는데 80이구요...
LinearyLayout 쓰기보다는 일반 view를 쓸수 있을겁니다.

1개의 답변

0 추천

빈 LinearyLayout 태그는 왜 쓰나요?

간격을 주기 위해서인가요?

간격을 주기 위해서라면 필요있는가요?

간격을 주기 위해서라면 

android:layout_marginTop="13dp"
이런것을 쓰면 될것 같네요...
도움이 되기를...
pjh0911 (300 포인트) 님이 2017년 4월 20일 답변
간격을 퍼센트로 주려고 했댔는데요,,, 그렇게는 못할까요?
...