一、自己定义的myView里面内容过大,一个屏幕根本显示不了,想通过加入滚动条来实现他的滚动,可是在我增加了滚动条之后(网上查,只能通过ScrollView来加滚动条),myView里面的内容就显示不了了,我想知道这是为什么?(看到的效果是,我的内容显示了一下,就没有了)
二、在重写的 onMeasure()方法中, 我加入了一句 System.out.println("测试") 打印了两次,有谁能告诉一下我,这个方法是怎么被调用的。
二、在重写的 onMeasure()方法中, 我加入了一句 System.out.println("测试") 打印了两次,有谁能告诉一下我,这个方法是怎么被调用的。
解决方案 »
- 史上最全的android开发资料大集合
- 无法用Sprite类的setTransform()方法实现图片旋转
- android 开发移动设备 求解!
- 关于android http get请求的问题
- 求真心的你帮我解释下下面的画图代码?怎么报答都行!!!
- 开发 Android手机方面的程序有什么成熟的编译器?
- 如何在图片上显示闪烁的标记?地图定位
- Android获取已连接远程蓝牙设备地址问题
- Android 系统广播Action和对应的权限
- 关于android的webview自动加载本地网页内的Iframe问题
- android.graphics.drawable怎么设置时间隐藏?
- 如何真机通过socket连接pc?
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(800, 2000); }
onMeasure 是view的函数,你自己再看下参数吧,肯定可以的
public myClass extendx View{
private int i = 0;
private String name = "zhangkai"
……
}
只能改变方法中的变量对 属性i 和属性name 是没有起作用的 (这里只是打比方)
Android 才入门 说的有错误 还请多多指教 !
楼主没看懂什么意思?我的页遇到和你一样的问题了?
能不能看看你怎么给自定义的View加的ScrollView,还有我将自定义的View加入ScrollView后也是不显示!望指导!谢谢
<LinearLayout
android:id="@+id/next_layout"
android:layout_width="fill_parent"
android:layout_height="0.0dp"
android:layout_margin="3dp"
android:layout_weight="2"
android:background="@android:color/darker_gray"
android:orientation="vertical" > <GridView
android:id="@+id/gridview_header"
android:layout_width="wrap_content"
android:layout_height="0.0dp"
android:layout_weight="1"
android:gravity="center"
android:numColumns="6" >
</GridView> <ScrollView
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="0.0dp"
android:layout_weight="3"
android:fillViewport="true">
<com.rj.weather.MyView
android:id="@+id/data"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView> <GridView
android:id="@+id/gridview_footer"
android:layout_width="wrap_content"
android:layout_height="0.0dp"
android:layout_weight="1"
android:gravity="center"
android:numColumns="6" >
</GridView>
</LinearLayout>楼主,我的问题基本一致,嵌套后滚动不了啊!感谢了