嵌套ListView时,为什么我的Framelayout无法点击?

时间:2016-02-25 09:44:26

标签: android listview android-appwidget android-adapterview android-framelayout

我有这样的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/widget_frame"
    android:orientation="vertical"
    android:textAlignment="gravity" >

    <FrameLayout
        android:id="@+id/widget_details"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginBottom="@dimen/widget_spacing"
        android:layout_marginLeft="@dimen/widget_spacing"
        android:layout_marginRight="@dimen/widget_spacing"
        android:background="@drawable/widget_background"
        android:gravity="center_vertical"
        android:padding="@dimen/widget_spacing" >

        <ListView
            android:id="@+id/image_flipper"
            android:clickable="true"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

        </ListView>
    </FrameLayout>

</LinearLayout>

我正在附加一个未决意图:

RemoteViews remView = new RemoteViews(ctxContext.getPackageName(), R.layout.widget);
PendingIntent pitClick = WidgetHelpers.getClickIntent(ctxContext, getKlass(), intInstance);
remView.setOnClickPendingIntent(R.id.widget_details, pitClick);
AppWidgetManager.getInstance(ctxContext).updateAppWidget(intInstance, remView);

如果我将ListView替换为AdapterViewFlipper之类的其他视图,则可行,但由于某种原因,ListView无法正确处理点击。使用ListView时,如果我非常小心地点击边缘,我可以点击,但是当使用AdapterViewFlipper时,整个内容都是可点击的。

0 个答案:

没有答案