안드로이드 스튜디오로 어플 실행시켰을 때 만든대로 화면이 안 뜬다면..?

조회수 1235회

저는 이런 식으로 화면을 구성했습니다. 이미지

빌드까지는 정상적으로 되는데 핸드폰으로 막상 실행시켜보면 이미지

이미지

이런식으로 나오는데 여기엔 어떤 이유가 있나요..? 답답해요..ㅠㅠ

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

  • 레이아웃을 만드실 때 뷰를 드래그엔드드롭해서 만드시지 마시고 직접 레이아웃 (리니어 레이아웃, 프레임레이아웃, 릴레이티브레이아웃 등)들의 특성을 공부해서 코딩으로 넣으시길 바랍니다.

    첨부하신 사진의 레아웃으로 대충 만들어보았습니다

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

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:padding="40dp">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal"
        android:gravity="center">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="20dp"
            android:text="Button1"/>
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:text="Button1"/>
    
    
    </LinearLayout>
    
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal"
        android:gravity="center">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="20dp"
            android:text="Button1"/>
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:text="Button1"/>
    
    
    </LinearLayout>
    
    <TextView
        android:layout_margin="50dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="sample"/></LinearLayout>
    
    • (•́ ✖ •̀)
      알 수 없는 사용자
    • 헉.. 진짜 진짜 감사합니다 ㅠㅠ 많은 도움이 되었습니다..ㅠㅠ 혹시 자바 공부할 때 추천하는 책 같은 거 있으시면 말씀해주실 수 있나요?? 제가 독학이라 좀 막막하네요..ㅠㅠㅠㅠ 알 수 없는 사용자 2017.9.11 22:00

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)