Ich habe eine HorizontalView. Im Inneren gibt es eine LinearLayout, wo ich mehrere ImageView durch Code hinzufügen. Ich möchte die NEXT und PREVIOUS-Taste implementieren, so dass es automatisch scrollt. Ich möchte auch die Tasten ausblenden, wenn ich das Ende meiner Horizontalansicht erreiche.Machen Sie die NEXT Taste in HorizontalView um durch verschiedene ImageView zu scrollen
Ich weiß nicht, wie es zu tun.
Edit: Diese CardView ist in einem RecyclerView.
Hier ist der XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_gravity="center"
android:layout_margin="8dp"
card_view:cardCornerRadius="4dp"
>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="1"
android:paddingTop="5dp">
<TextView
android:id="@+id/nombrecito"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="20sp"
android:fontFamily="fonts/rugs_font.otf"/>
<RelativeLayout>
<HorizontalScrollView
android:id="@+id/horizontal_scroll"
android:layout_width="wrap_content"
android:layout_height="254dp" >
<LinearLayout
android:id="@+id/linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:fitsSystemWindows="false">
<ImageView
android:id="@+id/foto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp"
android:contentDescription="fotografía"
android:scaleType="fitEnd"
android:src="@android:drawable/ic_menu_camera" />
</LinearLayout>
</HorizontalScrollView>
<ImageButton
android:shape="ring"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#ceb06a"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_keyboard_arrow_left_black_48dp"/>
<ImageButton
android:shape="ring"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#ceb06a"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_keyboard_arrow_right_black_48dp"/>
</RelativeLayout>
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="1">
<ImageButton
android:id="@+id/btnLike"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@android:color/transparent"
android:inAnimation="@anim/slide_in_likes_counter"
android:outAnimation="@anim/slide_out_likes_counter"
android:src="@drawable/ic_heart_outline_grey" />
<ImageButton
android:id="@+id/btnShare"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@android:color/transparent"
android:onClick="share"
android:src="@android:drawable/ic_menu_share" />
</GridLayout>
</GridLayout>
</android.support.v7.widget.CardView>
warum nicht mit Blick Pager für diese Arbeit? –
Danke. Ich werde es versuchen und sehen, wie es funktioniert. Ich werde Sie in Kontakt halten – Tostadora
Sie können Recycler Ansicht versuchen – Techgeek