我正在开发一个Android小部件,它的外观如下图所示:
[上一页] 事件名称 [下一页]
其中,prev和next是小部件上的按钮。我想在单击next和prev按钮时更新事件名称。在服务启动时,我加载了数据并将其存储在数组列表中。现在,我想通过单击小部件上的next和prev按钮来遍历数组列表。
请问如何实现这一功能?请给出详细的解决方案。以下是我的XML布局:
请问如何实现这一功能?请给出详细的解决方案。以下是我的XML布局:
<LinearLayout
android:id="@+id/lytWidget2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="horizontal" >
<Button
android:id="@+id/btnPreviousView"
android:layout_width="43dp"
android:layout_height="fill_parent"
android:layout_gravity="left|center"
android:background="@drawable/ic_leftarrow"
android:padding="5dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="52dp"
android:layout_weight="0.97"
android:text="Event Name" />
<Button
android:id="@+id/btnNextView"
android:layout_width="43dp"
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:background="@drawable/ic_rightarrow"
android:padding="5dip" />
</LinearLayout>