good work. working fine.
good work. working fine.
<?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="com.razormist.simpleimageviewer.MainActivity"> <ImageView android:id="@+id/iv_display" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:scaleType="fitXY" app:srcCompat="@drawable/img1" android:layout_marginBottom="30dp" android:layout_above="@+id/btn_right" /> android:id="@+id/btn_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RIGHT" android:layout_marginRight="42dp" android:layout_marginEnd="42dp" android:layout_alignBaseline="@+id/btn_left" android:layout_alignBottom="@+id/btn_left" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> android:id="@+id/btn_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginBottom="33dp" android:layout_marginLeft="43dp" android:layout_marginStart="43dp" android:text="LEFT" /> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.razormist.simpleimageviewer"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
private ImageView iv_display; private int current_image_index; private int[] images = {R.drawable.img1, R.drawable.img2, R.drawable.img3, R.drawable.img4, R.drawable.img5};
void DisplayImage(){ iv_display = (ImageView)findViewById(R.id.iv_display); } void SwitchButton(){ @Override current_image_index++; current_image_index = current_image_index % images.length; iv_display.setImageResource(images[current_image_index]); } }); @Override current_image_index--; if(current_image_index < 0){ current_image_index = images.length - 1; } iv_display.setImageResource(images[current_image_index]); } }); }
DisplayImage(); SwitchButton()
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.