:The Code
activity_main.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" tools:context=".MainActivity" android:background="@color/colorPrimaryDark"> <ImageView android:id="@+id/bg_shape" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/bg_shape" android:scaleType="fitStart" android:layout_alignParentTop="true" android:contentDescription="@string/todo"/> <ImageView android:id="@+id/emadzedan" android:layout_width="150dp" android:layout_height="150dp" android:contentDescription="@string/todo" android:src="@drawable/emadzedan" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="250dp"/> </RelativeLayout> strings.xml: <resources> <string name="app_name">AddImage</string> <string name="todo">Image</string> </resources> colors.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#3b376b</color> <color name="colorPrimaryDark">#ffde2f</color> <color name="colorAccent">#ffffff</color> </resources> MainActivity.java package com.emadzedan.addimage; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { ImageView bg_shape; ImageView emadzedan; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bg_shape = findViewById(R.id.bg_shape); emadzedan = findViewById(R.id.emadzedan); } }
:Files
Download Files:
AddImageFiles.zip