0

I am relatively new to Android platform so I don't know if there exists some specific way for doing this. Here goes my problem

I have a layout with a background image. On that background image I have 2 text views (one for header and other for sub header). Also I have four other image view for 4 very small images and 2 button. Now after fixed time interval (say 4 seconds ) I want all the background image, other 4 images and two text to change dynamically. Only the layout of buttons remains constant.

Rest all change after some time. Now this change should keep on happening.

Basically I need to show 4 screens. When user launch app , user see 1st screen then it changes to 2 screen then 3rd then 4th and then back to 1 and so on. I am currently using Animation.Drawable individually for background image and other four images. But i am unable to change text and the transition b/w images is not very smooth.

Is there a way by which i can solve this problem?

Here is my xml file

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/login_page"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:scrollbarAlwaysDrawVerticalTrack="true"
tools:context=".MainActivity" >

 <ImageView
    android:id="@+id/background_image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:contentDescription="TODO"
    android:scaleType="fitXY"
   />

  <ImageView
      android:id="@+id/dot_image"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/signin"
       android:layout_marginLeft="264dp"
      android:contentDescription="TODO"
      />
   <ImageView
      android:id="@+id/dot_image2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/signin"
       android:layout_marginLeft="284dp"
      android:contentDescription="TODO"
      android:src="@drawable/introdot_inactive" />
    <ImageView
      android:id="@+id/dot_image3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/signin"
       android:layout_marginLeft="304dp"
      android:contentDescription="TODO"
      android:src="@drawable/introdot_inactive" />
     <ImageView
      android:id="@+id/dot_image4"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/signin"
       android:layout_marginLeft="324dp"
      android:contentDescription="TODO"
      android:src="@drawable/introdot_inactive" />


  <com.facebook.widget.LoginButton
    android:id="@+id/facebook_signin"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_alignParentRight="true"
       android:layout_alignParentBottom="true"
    android:layout_marginBottom="120dp"
     android:layout_marginRight="43dp"

    />

  <Button
     android:id="@+id/signin"
     android:layout_width="wrap_content"

     android:layout_height="wrap_content"
     android:layout_alignBottom="@+id/facebook_signin"
     android:layout_alignLeft="@+id/SubHeaderText"
     android:layout_alignParentBottom="true"
     android:layout_alignTop="@+id/facebook_signin"
     android:layout_marginBottom="120dp"

     android:background="#BBBBBB"
     android:fitsSystemWindows="true"
     />


   <TextView
      android:id="@+id/HeaderText"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignLeft="@+id/signin"
      android:layout_alignParentTop="true"
      android:layout_marginTop="42dp"
      android:text="Welcome"
      android:textColor="#666666"
      android:textSize="23pt"
      android:typeface="serif" />

  <TextView
      android:id="@+id/SubHeaderText"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
       android:layout_marginLeft="44dp"

       android:layout_marginTop="152dp"
      android:text="Subheader text"
      android:textColor="#666666"
      android:textSize="15pt"
      android:typeface="serif" />



  </RelativeLayout>
Nunser
  • 4,512
  • 8
  • 25
  • 37

1 Answers1

0

You can change it setting the layout background resource in a UI thread or you can use framelayout. For frame layout you need to design an animation which is on the back and other components on the front.

Check this.

Community
  • 1
  • 1
Tugrul
  • 1,760
  • 4
  • 24
  • 39
  • Will the above solution also take care of swipe action? Such that user when swipe left , the previous screen comes up and vice-versa? – user2524233 Jun 27 '13 at 13:49