I'm beginner in android developpement and I want create a HorizontalScrollView who contains 2 RelativeLayout. Like this app :
And after clicking on a button or scrolling, a second layout appears
My current code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
tools:context="fr.hazpeople.lolbuildcreator.ChampActivity">
<RelativeLayout android:id="@+id/top_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/aatrox_bg"
android:scaleType="fitStart"
android:paddingRight="-1dp"
android:adjustViewBounds="true" />
<ImageView android:id="@+id/icon_champ"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="72dp"
android:minHeight="72dp"
android:src="@drawable/aatrox"
android:layout_alignBottom="@id/background"
android:layout_marginLeft="10dp" />
</RelativeLayout>
<!-- HorizontalScrollView here -->
</RelativeLayout>
答案 0 :(得分:0)
I think what you are looking for is ViewPager.
Here is an android example: https://developer.android.com/training/animation/screen-slide.html
For changing by clicking a button you may want to use PagerTabStrip