2017-02-07 11 views
0

내 안드로이드 앱에 3images를 넣었습니다. 첫 번째 이미지와 두 번째 이미지가 서로 아래에 있고 세 번째 이미지가 옆에 있습니다. 문제는 내가 서버 쪽 이미지와 크기가 다양하다는 것입니다. 화면에서 멋지게 보이게하려면 어떻게 구성해야합니까? 측면에 왼쪽, 3 일 1, 2 이미지 : 몇 가지로 편집3 이미지가 서로 나란히 있습니다.

<LinearLayout 
    android:paddingTop="5dp" 
    android:layout_width="match_parent" 
    android:orientation="horizontal" 
    android:layout_height="wrap_content"> 
    <LinearLayout 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content"> 
     <ImageView 
      android:id="@+id/image1" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/logo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
    <View android:background="@android:color/white" 
     android:layout_width="2dp" 
     android:layout_height="match_parent"/> 
    <LinearLayout 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content"> 
     <ImageView 
      android:id="@+id/image2" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/logo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
    <View android:background="@android:color/white" 
     android:layout_width="2dp" 
     android:layout_height="match_parent"/> 
    <LinearLayout 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content"> 
     <ImageView 
      android:id="@+id/image3" 
      android:src="@drawable/logo" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</LinearLayout> 

스크린 샷을 살펴보고 싶었다.

https://s30.postimg.org/bs6m2vtfl/Screen_Shot_2017_02_07_at_4_55_25_PM.png

+0

는 일부 스크린 샷을 공유 할 수 있습니까? – Krish

+0

크기가 어떻게 다를 수 있습니까? 항상 3 개를 전체 화면에 표시하고 싶습니까? 당신은 시도 할 수 layout_weight 및 match_parent 사용해보십시오 (이미지를 스트레칭/shring 것입니다) – X3Btel

+0

세 사진은 항상 800 * 1200 또는 1200 * 800 –

답변

-3

당신이 간단한 레이아웃을 시도 할 수는 레이아웃 중첩 정말 당신이 레이아웃과 반응 형 디자인에 대한 귀하의 질문에 명확하지으로이

<LinearLayout android:paddingTop="5dp" 
    android:layout_width="match_parent" 
    android:orientation="horizontal" 
    android:layout_height="wrap_content" 
    android:weightSum="3" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

     <ImageView 
      android:id="@+id/image1" 
      android:layout_weight="1" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/logo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 


     <ImageView 
      android:id="@+id/image2" 
      android:layout_weight="1" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/logo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

     <ImageView 
      android:id="@+id/image3" 
      android:layout_weight="1" 
      android:src="@drawable/logo" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
</LinearLayout> 
+0

그는 그들 옆에 제 3의 이미지를 원합니다. – X3Btel

+0

그는 자신의 옆에서 원하고있는 똑같은 것을 시도하고 있습니다. 자신의 문제를 해결할 수있는 android : orientation = "vertical"을 설정해야합니다. –

+0

은 스크린 샷으로 질문을 편집하여보다 명확하게 나타냅니다. –

1

처럼 사용해야 좋은 방법이 아니다. 당신이 머무르는 동안 이미지에 따라 답 :

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


<ImageView 
    android:layout_width="200dp" 
    android:layout_height="200dp" 
    android:id="@+id/imageView" 
    android:layout_marginTop="5dp" 
    android:layout_marginEnd="5dp" 
    android:scaleType="centerCrop" 
    android:src="@drawable/bob" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentEnd="true" /> 

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:layout_marginTop="5dp" 
    android:id="@+id/imageView2" 
    android:scaleType="centerCrop" 
    android:layout_marginEnd="5dp" 
    android:layout_marginStart="5dp" 
    android:src="@drawable/bob" 
    android:layout_alignParentTop="true" 
    android:layout_toStartOf="@+id/imageView" /> 

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:layout_marginTop="5dp" 
    android:id="@+id/imageView3" 
    android:layout_marginEnd="5dp" 
    android:layout_marginStart="5dp" 
    android:src="@drawable/bob" 
    android:scaleType="centerCrop" 
    android:layout_below="@+id/imageView2" 
    android:layout_toStartOf="@+id/imageView" 
    android:layout_alignBottom="@+id/imageView"/> 
</RelativeLayout> 

는 출력 :

enter image description here

관련 문제