开发者

Android RelativeLayout sometimes scrolls

I have made a layout with RelativeLayout. The layout includes quite a number of other elemen开发者_高级运维ts, from a couple of TableLayouts to several ImageButtons... The RelativeLayout itself has the following parameters :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bgimage">

Now I noticed that sometimes (mostly when coming out of the screensaver-mode, as in coming out of the black screen) the whole screen would be drawn as if it has moved like 50 pixels downwards, leaving a black space of 50 pixels on top... When I move my trackball (device is an ADP2, Google Ion) up and down the layout will move up and down as well, as if it's somehow scrollable... After loading another Actvity and getting back to the original one this behabiour will have corrected itself...

Does anyone have experienced something like this ? And how can this be solved ? Thanks in advance for any help/tips/pointers !


Try this in onResume of the Activity:

Handler handler = new Handler();
handler.post(new Runnable() {

    @Override
    public void run() {
        requestLayout();
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜