Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Material Design

You're reading from   Learning Material Design Master Material Design and create beautiful, animated interfaces for mobile and web applications

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785289811
Length 186 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Nadir Belhaj Nadir Belhaj
Author Profile Icon Nadir Belhaj
Nadir Belhaj
Kyle Mew Kyle Mew
Author Profile Icon Kyle Mew
Kyle Mew
Arrow right icon
View More author details
Toc

Revealing and hiding

Placing views and view groups in a layout and setting them as invisible, to be revealed later, is a lightweight and useful technique for changing the appearance of a screen without having to load separate activities or fragments. Furthermore, the circular reveal is designed specifically with material in mind.

Any view can be hidden and revealed, but for the sake of this exercise, we will use the following ImageView XML definition:

<ImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/some_image"
android:visibility="invisible" />

Reveal animations can be triggered by almost any event, but here we will simply use a button press. In your Java activity file, declare the button and image views as fields:

private ImageView imageView;
private Buttton...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime