Używam tego CoverFlow: http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.htmlZmień widok onClick coverflow - Android
chcę móc zmienić View po kliknięciu na przycisku, przycisk bycia tyłu/do przodu ikona, która zabierze Cię do poprzedni/następny element w przepływie okładki.
Zmodyfikowaliśmy nieco coverflow, aby zamiast tego użyć układu XML.
Oto onCreate() metoda moja:
setContentView(R.layout.main);
CoverFlow coverFlow = (CoverFlow)findViewById(R.id.coverflow);
coverFlow.setAdapter(new ImageAdapter(this));
ImageAdapter coverImageAdapter = new ImageAdapter(this);
coverFlow.setAdapter(coverImageAdapter);
coverFlow.setSpacing(-20);
coverFlow.setSelection(0, true);
coverFlow.setAnimationDuration(1000);
tv = (TextView)findViewById(R.id.textView1);
coverFlow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Toast.makeText(getBaseContext(), String.valueOf(arg2), Toast.LENGTH_SHORT).show();
}
});
coverFlow.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
tv.setText(String.valueOf(arg2));
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// Do something
}
});
Moje XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/home_background"
android:orientation="vertical" >
<com.demo.app.coverflow.CoverFlow
android:id="@+id/coverflow"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="39dp"
android:layout_marginLeft="35dp"
android:background="@drawable/button_left" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="39dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_right" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="55dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="hello"
android:textColor="@color/White"
android:textSize="16dp" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginRight="170dp"
android:layout_marginTop="15dp"
android:src="@drawable/unsa_logo" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="14dp"
android:layout_marginTop="23dp"
android:src="@drawable/pnc_logo" />
</RelativeLayout>
dać mi znać, jeśli moja odpowiedź nie ma sensu –
Hej, dzięki za odpowiedź, jestem Jestem studentem, aplikacja to aplikacja, którą tworzę dla firmy, nad którą pracuję, jednak w tym tygodniu i w przyszłym tygodniu jestem uczelnią (kurs trwa 2 tygodnie w firmie/2 tygodnie w uni itp ..) więc nie miałem okazji przetestować twojej odpowiedzi, ale wygląda bardzo obiecująco :) –
hahah. gotcha. przepraszam, nie chciałem się spieszyć. to było pytanie o nagrodę, więc byłem po prostu ciekawy. powodzenia!! –