滚动查看并刷新内容内容

由网友(森屿暖树)分享简介:我用下面的用户界面:一个父相对布局 parentLayout 与尺寸800×600(宽x高)A parent relative layout parentLayout with the dimensions 800x600 (width x height)第二相对布局 childLayout ,这是父布局的孩子。它具...

我用下面的用户界面:

一个父相对布局 parentLayout 与尺寸800×600(宽x高)

A parent relative layout parentLayout with the dimensions 800x600 (width x height)

第二相对布局 childLayout ,这是父布局的孩子。它具有尺寸800x1000,即,它是比母体布局更大

A second relative layout childLayout, which is a child of the parent layout. It has the dimensions 800x1000, i.e. it is larger than the parent layout.

parentLayout.addView(childLayout);

我的目标:滚动 childLayout 使用 childLayout.scrollTo(X,Y)

当我使用 childLayout.scrollTo(X,Y),Android的滚动 childLayout ,但不会刷新(重绘)吧。效果是, childLayout 切成相同尺寸 parentLayout

When I use childLayout.scrollTo(x,y), Android scrolls childLayout but doesn't refresh (redraw) it. The effect is, that childLayout is cut to the same dimensions as parentLayout.

不幸的是,下面的解决方案并没有解决问题:

Unfortunately, the following solutions don't solve the problem:

childLayout.scrollTo(x,y);
childLayout.invalidate();
childLayout.requestLayout();

任何想法如何解决这个问题?

Any ideas how to solve this problem?

推荐答案

您可以使用 parentLayout 滚动型代替的 RelativeLayout的并保持 childLayout RelativeLayout的

You can use parentLayout as ScrollView instead of RelativeLayout and keep childLayout as RelativeLayout.

阅读全文

相关推荐

最新文章