2010-04-27 2 views
0

나는이 같은보기를 달성하기 위해 노력하고 있습니다 : 왼쪽면 = 라이브 카메라 미리보기, 오른쪽면 = 4 개의 이미지 열. 하지만 다음 XML로 관리하는 모든 것은 전체 화면 라이브 카메라 미리보기입니다. Android 1.5 에뮬레이터.이 레이아웃에 어떤 문제가 있습니까? 안드로이드

감사

아래 하나
<?xml version="1.0" encoding="utf-8"?> 

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

    <proto.wiinkme.SurfaceViewEx 
     android:id="@+id/preview" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_weight="3"/> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@+id/preview" 
     android:layout_alignParentRight="true" 
     android:layout_weight="1"> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/mother_earth" 
      android:src="@drawable/mother_earth_show" /> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/meadow" 
      android:src="@drawable/meadow_show" /> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/trap" 
      android:src="@drawable/trap_show" /> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/whistle" 
      android:src="@drawable/whistle_show" /> 


    </LinearLayout> 

</RelativeLayout> 

답변

0

체크 아웃 ... 그것은 .... 당신과 함께 선형 레이아웃을 교체

..... 당신의 필요 조건에 따라 작동

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <LinearLayout 
     android:id="@+id/preview" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_weight="3"> 
     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:src="@drawable/icon" /> 
    </LinearLayout> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@+id/preview" 
     android:layout_alignParentRight="true" 
     android:layout_weight="2"> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/mother_earth" 
      android:src="@drawable/icon" /> 

     <ImageView 
      android:layout_below = "@+id/mother_earth" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/meadow" 
      android:src="@drawable/icon" /> 

     <ImageView 
      android:layout_below = "@+id/meadow" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/trap" 
      android:src="@drawable/icon" /> 

     <ImageView 
      android:layout_below = "@+id/trap" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/whistle" 
      android:src="@drawable/icon" /> 


    </RelativeLayout> 

</RelativeLayout> 
+0

thie 레이아웃을 삭제 해 주셔서 감사합니다. 아직도해야하는대로 작동하지 않습니다. – kellogs

+0

레이아웃 "proto.wiinkme.SurfaceViewEx"는 선형 또는 상대입니다 ....? – Vishwanath

+0

레이아웃이 아니며 SurfaceView에서 파생 된 클래스입니다. – kellogs

1

Vishwanath,

다음과 같이 레이아웃을 조정했습니다 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <LinearLayout 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_weight="3"> 

     <proto.wiinkme.SurfaceViewEx 
      android:id="@+id/preview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"/> 

    </LinearLayout> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@+id/preview" 
     android:layout_alignParentRight="true" 
     android:layout_weight="2"> 

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/mother_earth" 
      android:src="@drawable/mother_earth_show" /> 

     <ImageView 
      android:layout_below = "@+id/mother_earth" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/meadow" 
      android:src="@drawable/meadow_show" /> 

     <ImageView 
      android:layout_below = "@+id/meadow" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/trap" 
      android:src="@drawable/trap_show" /> 

     <ImageView 
      android:layout_below = "@+id/trap" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/whistle" 
      android:src="@drawable/whistle_show" /> 

     <Button 
      android:layout_below = "@+id/whistle" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/reset" 
      android:text="Reset" /> 

     <Button 
      android:layout_below = "@+id/reset" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/save" 
      android:text="Save" /> 


    </RelativeLayout> 

</RelativeLayout> 

그리고 약간 이상한 효과가있었습니다.

0

이 방법을 사용하여이 방법을 사용했지만 여전히 잘못되어 있습니다. 즉, 'dips'에서 요소의 크기를 하드 코드했습니다. 아마 1.6 이전에는 괜찮 았지 만, 1.6 이후에 1.6 버전의 안드로이드는이 레이아웃이 320 x 480 3.2 인치 이상의 다른 스크린에서 깨질 것입니다.

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <proto.wiinkme.SurfaceViewEx 
     android:id="@+id/preview" 
     android:layout_height="fill_parent" 
     android:layout_width="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_weight="3"/> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@+id/preview" 
     android:layout_alignParentRight="true" 
     android:layout_weight="1"> 

     <ImageView 
      android:layout_width="100dip" 
      android:layout_height="80dip" 
      android:id="@+id/mother_earth" 
      android:src="@drawable/mother_earth_show" /> 

     <ImageView 
      android:layout_width="100dip" 
      android:layout_height="80dip" 
      android:id="@+id/meadow" 
      android:src="@drawable/meadow_show" /> 

     <ImageView 
      android:layout_width="100dip" 
      android:layout_height="80dip" 
      android:id="@+id/trap" 
      android:src="@drawable/trap_show" /> 

     <ImageView 
      android:layout_width="100dip" 
      android:layout_height="80dip" 
      android:id="@+id/whistle" 
      android:src="@drawable/whistle_show" /> 

     <Button 
      android:layout_marginTop="4dip" 
      android:layout_width="78dip" 
      android:layout_height="80dip" 
      android:id="@+id/reset" 
      android:text="Reset" /> 

     <Button 
      android:layout_width="78dip" 
      android:layout_height="80dip" 
      android:id="@+id/save" 
      android:text="Save" /> 


    </LinearLayout> 

</LinearLayout> 
관련 문제