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

RelativeLayout에서 imageview질문드려요..

0 추천
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

      <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_margin="10dp"
        android:src="@drawable/whale"/>

       <Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@id/imageView1"
          android:text="button1" />

      <Button
          android:id="@+id/button2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@id/imageView1"
          android:layout_toRightOf="@id/button1"
          android:text="button2" />
      
      
</RelativeLayout>

 

이미지를 맨위에 띄우고 그 밑에 버튼 2개씩 쓰려고 하는데 ..

이미지가 화면 중간에 뜨고 버튼은 안뜨네요..
또 이미지를 안띄워보면 버튼은 제대로 나오는데 ...
아 뭐가 문제일까요 ㅠㅠ
douglas (340 포인트) 님이 2015년 1월 14일 질문
douglas님이 2015년 1월 14일 수정

1개의 답변

0 추천
 
채택된 답변
  1. 먼가 잘안될때는 graphical layout 을 사용해보시는것도 좋습니다. 코드상만으로 봤을때는 크게 문제는 없어 보입니다.
  2. xml 말고 java 쪽에서 먼가 수정하시는건 없는지 확인해보세요
  3. android:orientation="vertical" 는 relative 에 없어도 되는 것이니 빼셔도 좋습니다.

 

aucd29 (218,390 포인트) 님이 2015년 1월 14일 답변
douglas님이 2015년 1월 14일 채택됨
혹시나 해서 이미지 사이즈를 바꿔보았더니 제대로 뜨네요..으이구 멍청하네요 ㅠ....답변 감사합니다.!
...