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

에디트 텍스트의 길이를 맞추고 싶은데.. 잘 안됩니다 ㅠ ㅠ

+1 추천

 

안녕하세요.

제가 지금 에디트텍스트의 간격 때문에, 깊은 고민에 빠져있습니다.

아래의 사진에서 보면, 홍길동이라고 써진 그 간격만큼, 그 아래에 있는 생년월일들의 EditText를

저 홍길동의 길이에 맞추고 싶은데, 어떻게 해야 할지 참 고민입니다.

소스를 몇번이고 수정을 해보아도, 제가 버튼 디자인을 준 .xml 떄문인지 아니면 어디에 문제인지

아래의 사진과 같이 홍길동의 길이보다 더 삐져나가서 저렇게 못나보이게 나옵니다.

어떻게 수정을 해주어야 할지 잘 모르겠습니다 ㅠ ㅠ

아래에 소스를 한번 첨부해 보겠습니다. 8000자가 넘어서, 아래의 댓글에 좀 더 붙여보겠습니다.

 

<Register.xml 파일>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp">

    <TextView
        android:id="@+id/Text_register_Name"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="15dp"
        android:textStyle="bold"
        android:textColor="#000000"
        android:textSize="13sp"
        android:text="이름"/>

    <EditText
        android:id="@+id/Edit_Register_Name"
        android:maxLines="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_toRightOf="@+id/Text_register_Name"

        android:layout_marginRight="45dp"

        android:paddingTop="10dp"
        android:paddingBottom="10dp"

        android:background="@drawable/white_round_button"
        android:textAlignment="center"
        android:hint="홍 길 동"/>


</RelativeLayout>


 
Kind카인드 (3,600 포인트) 님이 2016년 11월 1일 질문
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp">

    <TextView
        android:id="@+id/Text_register_Birth_Year"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="15dp"
        android:textStyle="bold"
        android:textColor="#000000"
        android:textSize="13sp"
        android:text="생년월일"/>


    <EditText
        android:id="@+id/Edit_Register_Birth_Year"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="2dp"
        android:background="@drawable/white_round_button"
        android:layout_weight="1" />
    <EditText
        android:id="@+id/Edit_Register_Birth_Month"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/white_round_button"
        android:layout_marginLeft="2dp"
        android:layout_marginRight="2dp"
        android:layout_weight="1" />

    <EditText
        android:id="@+id/Edit_Register_Birth_Day"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/white_round_button"
        android:layout_marginLeft="5dp"
        android:layout_weight="1"/>


</LinearLayout>
 
<white_round_button 의 버튼의 색상과 디자인 관련된 코드 >

<?xml version="1.0" encoding="utf-8"?>

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="30dp"
    android:shape="rectangle"
    >
    <corners android:radius="10dp" />
    <stroke
        android:width="2dp"
        android:color="#000000" />
    <solid
        android:color="#ffffff"
        />

</shape>

1개의 답변

0 추천
 
채택된 답변
weight 또는

홍길동의 width를 150dp이라고 가정하면

나머지 3개를 Linear하나로 묶어서 width 150dp
익명사용자 님이 2016년 11월 1일 답변
Kind카인드님이 2016년 11월 1일 채택됨
...