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

간단한 버튼 사이즈 조절 질문드립니다.

0 추천

안녕하세요 저 화면에서 로그인 버튼을 "dp" 값으로 지정하지 않고 pw까지 height가 차게 하고 싶은데요.

align bottom 이나 baseline 으로 pw 값까지 지정하게 되면 

 Error: No resource found that matches the given name

라는 오류가 뜨네요.. dp로 지정하는거 말고 상대적 값 사용해서 pw까지 차게 하는 방법이 없을까요??

 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

     <Button
        android:id="@+id/loginBtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp"
        android:text="@string/login" />

    <EditText
        android:id="@+id/urnameEntry"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/loginBtn"
        android:layout_toLeftOf="@+id/loginBtn"
        android:hint="@string/IDhint" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/pwEntry"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/urnameEntry"
        android:layout_alignLeft="@id/urnameEntry"
        android:hint="@string/PWhint"
        android:inputType="textPassword" />

</RelativeLayout>

 

douglas (340 포인트) 님이 2015년 1월 25일 질문

1개의 답변

+1 추천
 
채택된 답변

LinearLayout을 사용하시면 됩니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_weight="1"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/urnameEntry"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="@string/IDhint" >

                <requestFocus />
            </EditText>

            <EditText
                android:id="@+id/pwEntry"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="@string/PWhint"
                android:inputType="textPassword" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:orientation="vertical" >

            <Button
                android:id="@+id/loginBtn"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="@string/login" />
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>

nicehee (73,100 포인트) 님이 2015년 1월 26일 답변
douglas님이 2015년 1월 27일 채택됨
와 이렇게 하면 되군요! 정말 감사합니다!
...