Android Can';t在第一次布局后获取viewWidth(ViewPager中的WebView)

Android Can';t在第一次布局后获取viewWidth(ViewPager中的WebView),android,android-layout,view,android-webview,android-viewpager,Android,Android Layout,View,Android Webview,Android Viewpager,稍后我将更新一个完整的教程,介绍如何在ViewPager中实现WebView,但我遇到了一个非常奇怪的问题,我不知道如何解决 以下是我正在运行的实现 XML: 网络视图在单独的(InitWebViews)中设置 你知道为什么会这样吗,或者我如何强制viewWidth为1280?或者我初始化WebViews的方式还有其他问题吗?问题是?你应该把问题清楚地放在某个地方。现在有些问题在标题中,有些在正文的底部。非常混乱。 <android.support.v4.view.ViewPag

稍后我将更新一个完整的教程,介绍如何在
ViewPager
中实现
WebView
,但我遇到了一个非常奇怪的问题,我不知道如何解决

以下是我正在运行的实现

XML:

网络视图在单独的(InitWebViews)中设置


你知道为什么会这样吗,或者我如何强制
viewWidth
为1280?或者我初始化
WebView
s的方式还有其他问题吗?

问题是?你应该把问题清楚地放在某个地方。现在有些问题在标题中,有些在正文的底部。非常混乱。
     <android.support.v4.view.ViewPager
     android:id="@+id/viewpager"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_above="@+id/lastLoginText"
     android:layout_alignParentLeft="true"
     android:layout_alignParentRight="true"
     android:layout_alignParentTop="true"
     android:layout_below="@+id/PreferencesButton" >

     </android.support.v4.view.ViewPager>
((ViewPager) collection).removeAllViews();
WebView a = webview[position];
((ViewPager) collection).addView(a);
    webview[0] = new WebView(this.getApplicationContext());
    webview[0].loadUrl("file:///android_asset/test.html");
    webview[1] = new WebView(this.getApplicationContext());
    webview[1].loadUrl("file:///android_asset/test.html");
    webview[2] = new WebView(this.getApplicationContext());
    webview[2].loadUrl("file:///android_asset/test.html");