2012-09-06 52 views
0

裏面我有這樣的佈局:網頁視圖滾動/尺寸問題時,複雜的佈局

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

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 

<ImageView android:layout_width="200dp" 
    android:layout_height="200dp" 
    android:layout_gravity="center_horizontal"/> 


<WebView 
    android:id="@+id/htmlView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 

/> 

</ScrollView> 

Webview是隻是用於顯示HTML格式的文本,我不需要任何特殊功能。 問題是,我沒有得到一個滾動的佈局,但這樣的事情:


的TextView(佈局的大約佔30%,而不是滾動)


圖像(大,約50 %不滾動)


微小的滾動網頁流量


問題在哪裏?

回答

1

這可能會幫助你......

parentScrollView.setOnTouchListener(new View.OnTouchListener() { 

        public boolean onTouch(View v, MotionEvent event) { 
         Log.v(TAG,"PARENT TOUCH"); 
         findViewById(R.id.webView).getParent().requestDisallowInterceptTouchEvent(false); 
         return false; 
        } 
       }); 
       webView.setOnTouchListener(new View.OnTouchListener() { 

        public boolean onTouch(View v, MotionEvent event) 
        { 
         Log.v(TAG,"CHILD TOUCH"); 
         // Disallow the touch request for parent scroll on touch of child view 
         v.getParent().requestDisallowInterceptTouchEvent(true); 
         return false; 
        } 
       });