2017-06-04 1 views
-1

をクリックして2つのImageViewのとディスプレイを追加する方法ボタン上の単一の画像は、私はこれを合成して新しいイメージ図として表示することがimageviews必要

私は両方imageviewsをマージしようとしていますが、画像のようにマージ取得されていません単一の画像。

この画像はフレームでなければならず、他の画像は空白にする必要があります

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    collageImage = (ImageView)findViewById(R.id.center); 
    Button combineImage = (Button)findViewById(R.id.Btn_comineimage); 
    combineImage.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.multiple); 
      smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.multipletwo); 
      mergeimage();//merge and display on click. 



     } 
    }); 


} 

public void mergeimage() 
{ 
    //need code for combining both image to one and setimagebitmap to collageimage. 

} 

Main.xml

ここで私はあなたの参照のための私のxmlコーディングを添付しています。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:id="@+id/Main_layout" 
tools:context="com.imagemerge.albin.imagemerge.MainActivity"> 
<ImageView 
android:id="@+id/base" 
android:layout_height="200dp" 
android:layout_width="200dp" 
android:src="@drawable/multiple" 
android:scaleType="fitXY" 
android:layout_alignTop="@+id/center" 
android:layout_alignParentLeft="true" 
android:layout_alignParentStart="true" /> 
<ImageView 
android:id="@+id/center" 
android:layout_height="180dp" 
android:layout_width="85dp" 
android:src="@drawable/multipletwo" 
android:layout_marginLeft="230dp" 
android:layout_marginTop="15dp" 
android:scaleType="fitXY"/> 
<Button 
android:id="@+id/Btn_comineimage" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_alignEnd="@+id/center" 
android:layout_alignRight="@+id/center" 
android:layout_below="@+id/base" 
android:layout_marginEnd="89dp" 
android:layout_marginRight="89dp" 
android:layout_marginTop="10dp" 
android:text="Merge" /> 
<ImageView 
android:id="@+id/Mergedimage" 
android:layout_width="200dp" 
android:layout_height="200dp" 
android:layout_below="@+id/Btn_comineimage" 
android:layout_marginLeft="100dp" 
android:background="@color/colorAccent" 
android:scaleType="fitXY" 
android:layout_marginTop="10dp" 
/> 
</RelativeLayout> 
+0

レイアウトのコードを添付してください。ありがとう。 – aborocz

+0

@aboroczレイアウト用のXMLコーディングが添付されています –

答えて

関連する問題