0
我有这样的自定义视图类作为内部类:自定义滚动型NoSuchMethodException
public class GraphFragment extends SherlockFragment {
[...]
public class FlingableScrollView extends ScrollView {
public FlingableScrollView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
public FlingableScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FlingableScrollView(Context context) {
super(context);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
super.dispatchTouchEvent(ev);
return gestureListener.onTouch(this, ev);
}
}
}
,并在我的XML布局:
<view
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.GraphFragment$FlingableScrollView" >
它不会因为这个错误的工作:
04-04 20:04:41.001: E/AndroidRuntime(2011): Caused by: java.lang.NoSuchMethodException: [class android.content.Context, interface android.util.AttributeSet]
为什么?