public class ParallaxPage extends Page
Page with three elements: a front image, a back image and text. The front and back
images are centred at the top the Page, such that the front image is drawn on top of the back
image. The text is drawn over both images. This class can be used in an IntroActivity
with a ParallaxTransformer to create a parallax scrolling effect, where the images
transition at different speeds. To allow the use of custom transformers, the resource ids of the
views can be accessed using the getFrontImageHolderResId(), getBackImageHolderResId() and getTextHolderResId() methods.| Modifier and Type | Field and Description |
|---|---|
protected android.graphics.Bitmap |
backImage
The current back image.
|
protected android.widget.ImageView |
backImageHolder
The View which displays the back image.
|
protected android.graphics.Bitmap |
frontImage
The current front image.
|
protected android.widget.ImageView |
frontImageHolder
The View which displays the front image.
|
protected android.widget.FrameLayout |
rootView
The root view of this Fragment.
|
protected java.lang.CharSequence |
text
The current text.
|
protected android.widget.TextView |
textHolder
The View which displays the text.
|
| Constructor and Description |
|---|
ParallaxPage()
Required default empty constructor.
|
| Modifier and Type | Method and Description |
|---|---|
android.graphics.Bitmap |
getBackImage() |
int |
getBackImageHolderResId() |
android.graphics.Bitmap |
getFrontImage() |
int |
getFrontImageHolderResId() |
java.lang.CharSequence |
getText() |
int |
getTextHolderResId() |
static ParallaxPage |
newInstance() |
void |
notifyBackImageChanged()
Updates the UI of this ParallaxPage to reflect the image supplied to
(Bitmap). |
void |
notifyFrontImageChanged()
Updates the UI of this ParallaxPage to reflect the image supplied to
setFrontImage(Bitmap). |
void |
notifyTextChanged()
Updates the UI of this ParallaxPage to reflect the text supplied to
setText(CharSequence). |
void |
onCreate(android.os.Bundle savedInstanceState) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
setBackImage(android.graphics.Bitmap backImage)
Sets the back image of this ParallaxPage.
|
void |
setFrontImage(android.graphics.Bitmap frontImage)
Sets the front image of this ParallaxPage.
|
void |
setText(java.lang.CharSequence text)
Sets and displays the text of this ParallaxPage.
|
getDesiredBackgroundColor, setDesiredBackgroundColorprotected android.widget.FrameLayout rootView
protected android.widget.ImageView frontImageHolder
protected android.widget.ImageView backImageHolder
protected android.widget.TextView textHolder
protected android.graphics.Bitmap frontImage
protected android.graphics.Bitmap backImage
protected java.lang.CharSequence text
public static ParallaxPage newInstance()
public android.view.View onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
public void onCreate(android.os.Bundle savedInstanceState)
public void setFrontImage(android.graphics.Bitmap frontImage)
frontImage - the image to displaypublic android.graphics.Bitmap getFrontImage()
public int getFrontImageHolderResId()
public void setBackImage(android.graphics.Bitmap backImage)
backImage - the image to displaypublic android.graphics.Bitmap getBackImage()
public int getBackImageHolderResId()
public void setText(java.lang.CharSequence text)
text - the text to displaypublic java.lang.CharSequence getText()
public int getTextHolderResId()
public void notifyFrontImageChanged()
setFrontImage(Bitmap). There is no need to explicitly call this method after calling setFrontImage(Bitmap).public void notifyBackImageChanged()
(Bitmap). There is no need to explicitly call this method after calling setBackImage(Bitmap).public void notifyTextChanged()
setText(CharSequence). There is no need to explicitly call this method after calling setText(CharSequence).