Android UI:ViewFlipper
main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ><ViewFlipper android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/viewFipper01"> <include android:id="@+id/layout1" layout="@layout/layout1"/> <include android:id="@+id/layout2" layout="@layout/layout2"/></ViewFlipper></LinearLayout>
layout1.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_height="wrap_content" android:layout_width="fill_parent" android:src="@drawable/ni_png_0120" /> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center" android:text="Cat" android:textSize="20pt" /></LinearLayout>
layout2.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_height="wrap_content" android:layout_width="fill_parent" android:src="@drawable/ni_png_0115" /> <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center" android:text="Fish" android:textSize="20pt"> </TextView></LinearLayout>
ViewTestActivity.java
package com.view.ViewFlippertest;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.animation.AnimationUtils;import android.widget.ViewFlipper;public class ViewTestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ViewFlipper vf = (ViewFlipper)findViewById(R.id.viewFipper01); vf.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { vf.showNext(); } }); vf.setInAnimation(AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left)); vf.setOutAnimation(AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_out_right)); }}
You must Sign up as a member of Effecthub to view the content.
Latest Posts
- Android: CookieManager removeAllCookie() Crash
- XlistView: A listview which can pull to refresh and load more (1)
- Millions of Android Phones Could Be Affected by the Heartbleed Bug. Check to See if Yours Is One of Them
- TOP 10 ANDROID GAMES FOR MARCH 2014
- Android:Button with different textcolor and background in different states
3017 views 1 comments
You must Sign up as a member of Effecthub to join the conversation.