【发布时间】:2012-08-19 17:36:07
【问题描述】:
编辑: 这是显示问题的视频:www.youtube.com/watch?v=5ZZsuMH5T9k 我真的被困在这里了:/
--
我有一个活动,它由一个 webview 和一个底部的按钮组成。我在onCreate 中使用此代码将活动的窗口设置为全屏:
@Override
public void onCreate(Bundle savedInstanceState) {
InstaFetchApplication.applyCurrentTheme(this);
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
requestWindowFeature(Window.FEATURE_PROGRESS);
if (UserPreferences.getIsFullScreenReadingEnabled(this)) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
// this just do this: window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
ActivityUtils.toggleFullScreen(this, true);
}
setContentView(R.layout.view_article);
// ...
}
问题在于大部分时间 web 视图似乎将按钮“推”出屏幕。截图如下:
我希望看到的(有时我会看到)在这里:
这是我正在使用的布局(请注意,在我的应用中,顶部布局必须是 RelativeLayout):
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_test"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Click me!"
/>
<WebView
android:id="@+id/web_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/button"
/>
</RelativeLayout>
我还注意到,如果您使用系统设置关闭设备上的所有动画,问题就消失了(尽管当整个视图有一个上边距然后它跳回到正确的位置时会出现这个故障)。
有没有人遇到过类似的问题并知道如何解决?
【问题讨论】:
-
你能发一下
onCreate() -
你是在设备还是模拟器上测试?
-
你能发布你的代码吗?您需要标题栏中的进度对话框吗?
Window.FEATURE_PROGRESS应该与setProgressBarVisibility(true)一起使用,或者如果您不想要进度条,则根本不使用。如果你想隐藏标题栏,那么你可以使用android:windowNoTitle -
@AdilSoomro 我已经更新了问题。
-
@LalitPoptani 模拟器和设备都出现问题。
标签: android layout webview fullscreen