ViewFlipper mit imageView

  • Antworten:2
TheStephan
  • Forum-Beiträge: 14

14.03.2019, 10:18:01 via Website

Hallo liebe Community, ich bräuchte mal wieder eure Hilfe.

Ich möchte eine Bilder Slideshow programmieren, wo ich mittels buttons nach vorne oder zurück gehen kann. Ich habe mich für einen ViewFlipper entschieden. Der Code funktioniert mit buttons und textviews fehlerfrei, füge ich jedoch ein ImageView aus dem drawable Ordner hinzu, stürzt die App ab.
Habe ich einen Codezusatz vergessen oder ist Viewflipper nicht dazu geeignet?

Der Code:


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"
tools:context=".bilder415">

<ViewFlipper
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/viewFlipper">

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitXY"
        android:id="@+id/imageView"
        android:src="@drawable/karte4"/>

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitXY"
        android:id="@+id/imageView2"
        android:src="@drawable/karte5"/>


</ViewFlipper>

<Button
    android:id="@+id/next"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Next"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"/>

<Button
    android:id="@+id/previous"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Prev"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:layout_alignTop="@+id/next"/>

Kommentieren
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

15.03.2019, 20:44:26 via Website

Evtl. sind deine Bilder aus Drawable acuh zu groß und du bekommst ein Speicherproblem.
Am besten den Log hier posten, wie Rafael gesagt hat.

LG Pascal //It's not a bug, it's a feature. :) ;)

Hilfreich?
Kommentieren