首页 > 解决方案 > 如何在xamarin android中的framelayout内触摸图像时启用

问题描述

我在框架布局中使用 Imageview 和文本视图,当我被触摸时只检测图像区域,如何实现这一点。谢谢提前

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
     android:layout_gravity="center"
     android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    
    android:background="@color/colorAccent">
    <FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/frameLayout1"
        android:background="@android:color/black"
        android:clickable="true">
        <ImageView
            android:src="@drawable/Car"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/imageView1" />
    <TextView
            android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textColor="#FFFFFF"
         android:textStyle="bold"/>
</FrameLayout>
</RelativeLayout>

标签: c#xamarin.androidandroid-framelayouttouchimageview

解决方案


推荐阅读