我有这种情况。我正在创建自定义 GridView。我有一个 ScrollView 并MyViewGroup在其中使用MyViewGroupextends ViewGroup。我想加载图像。对于每个图像,我使用一个单元格,其中 RelativeLayout包含 ImageView。像这样
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" />
问题是单元格被正确加载,但图像没有被加载。MyViewGroup但是,如果我从扩展FrameLayout而不是ViewGroup它可以正常工作。但我必须使用而ViewGroup不是FrameLayout我只覆盖OnLayout.MyViewGroup
所以我的问题是我怎样才能使图像正确加载使用ViewGroup,什么属性或属性FrameLayout有,没有ViewGroup?
先感谢您。