सोमवार, 13 फ़रवरी 2017

Android Studio Using view Flipper Automatic image Swipe





xml file code-
<?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:id="@+id/myLayout"    
android:layout_width="match_parent"    
android:layout_height="match_parent"   
tools:context="com.example.vishal.autoimage.MainActivity">

<ViewFlipper        
android:id="@+id/flipper1"       
android:layout_width="fill_parent"        
android:layout_height="163dp"       
android:paddingTop="55dp"        
android:flipInterval="3000"       
android:autoStart="true"        
android:inAnimation="@android:anim/slide_in_left"        
android:outAnimation="@android:anim/slide_out_right"        
android:layout_centerInParent="true"        
>
       
<ImageView           
android:src="@drawable/image1"            
android:layout_width="fill_parent"            
android:layout_height="match_parent"           
android:layout_gravity="center_horizontal" />
<ImageView            
android:src="@drawable/image2"            
android:layout_width="fill_parent"            
android:layout_height="match_parent"            
android:layout_gravity="center_horizontal" />
<ImageView            
android:src="@drawable/image3"            
android:layout_width="fill_parent"           
android:layout_height="match_parent"            
android:layout_gravity="center_horizontal"/>
<ImageView            
android:src="@drawable/image4"            
android:layout_width="fill_parent"           
android:layout_height="match_parent"            
android:layout_gravity="center_horizontal"/>
<ImageView           
android:src="@drawable/image5"            
android:layout_width="fill_parent"            
android:layout_height="match_parent"            
android:layout_gravity="center_horizontal"/>

</ViewFlipper>

</RelativeLayout>


java code- but no change java only change xml ok..
  
public class MainActivity extends AppCompatActivity {


    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



            }
        }

Inline image 1

Inline image 4
Inline image 5
Inline image 2
Inline image 3
and last paste images.. drawable folder