加载视图时按钮抖动

时间:2015-01-07 00:59:05

标签: android

我的观点是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:id="@+id/layout"
    android:layout_height="match_parent"
    android:divider="@drawable/divider"
    android:orientation="vertical"
    android:showDividers="middle" >

    <Button
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_gravity="center"
        android:text="@string/self_destruct"
        android:onClick="selfDestruct" />

    <WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />
    </LinearLayout>

我的清单是:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.nicobeta.camerabeta" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Home"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="eu.janmuller.android.simplecropimage.CropImage" />

        <activity
            android:name=".PreviewLibrary"
            android:label="@string/title_activity_preview_library" >
        </activity>
        <activity
            android:name=".postProcessing"
            android:label="@string/title_activity_post_processing" >
        </activity>
    </application>

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

我的styles.xml文件是:

<resources>
<color name="white_opaque">#FFFFFFFF</color>
<color name="pitch_black">#FF000000</color>

<style name="AppTheme" parent="android:Theme.Light">
    <item name="android:background">@color/white_opaque</item>
    <item name="android:windowBackground">@color/white_opaque</item>
    <item name="android:colorBackground">@color/white_opaque</item>
    <item name="android:windowNoTitle">true</item>

</style>

</resources>

我已尝试删除标题栏,如上所示。但是,当我通过以下方式加载视图时:

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d("postProcessing","Post Processing Started");
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        setContentView(R.layout.activity_post_processing);
    }

我得到一个生涩的动作。首先,按钮位于视图上方,部分不可见,然后按钮快速向下移动,使其适合屏幕。我如何摆脱这种抽搐动作?

1 个答案:

答案 0 :(得分:0)

尝试更改webview的高度以包装内容,如下所示

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_parent"
        />