1
我有一个名为CropImageView
的类,它从ImageView
扩展。但下面的语句使castException
:如何找到自定义扩展视图的视图
CropImageView image = (CropImageView) findViewById(R.id.image);
这里是xml文件:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ImageView android:id="@+id/image"
android:background="#55000000"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_x="0dip"
android:layout_y="0dip"/>
</RelativeLayout>
</FrameLayout>
你有什么建议吗?