在我的WebView ScrollView无法正常工作,我该如何解决这个问题?

时间:2011-09-01 10:03:45

标签: android android-webview

实际上我有一个xml文件,其中包含很多视图,如textview,button和webview在顶层我采取一个滚动视图,然后父线性布局介于其他视图之间,还有webview,但我可以' t滚动WebView。这是我的xml文件。请帮帮我。

和'ö'此字符未在webview中显示 代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:background ="@drawable/main_bg"
  android:layout_height="wrap_content"
  android:orientation ="vertical">
    <LinearLayout
        android:layout_width ="fill_parent"
        android:layout_height ="wrap_content"
        android:background ="@drawable/global_logo">
    </LinearLayout>
    <ScrollView
        android:layout_width = "fill_parent"
        android:layout_height = "fill_parent"
        android:layout_weight = "1">
            <LinearLayout
                android:layout_width ="fill_parent"
                android:layout_height ="wrap_content"
                android:layout_weight = "1"
                android:orientation ="vertical">
                <TextView
                    android:id ="@+id/txtJobTitle"
                    android:layout_width ="wrap_content"
                    android:layout_height ="wrap_content"
                    android:text = "DHL Systems"
                    style = "@style/txtcolor"/>
                <TextView 
                    android:id="@+id/txtCompanyName"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="Company Name"
                    android:textColor="#000"
                    />
                <TextView
                    android:id ="@+id/txtPosition"
                    android:layout_width ="fill_parent"
                    android:layout_height ="wrap_content"
                    android:textColor="#000"
                    android:text = "PHP, WebTechnology" 
                    />
                <LinearLayout 
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <TextView
                        android:id = "@+id/txtPlace"
                        android:layout_width = "fill_parent"
                        android:layout_height = "wrap_content"
                        android:textColor="#000"
                        android:layout_weight="1"
                        android:text = "Place"
                        android:textStyle = "bold"/>
                    <TextView 
                        android:id="@+id/txtDate"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:textColor="#000"
                        android:layout_weight="1"
                        android:gravity="right"
                        android:text="11-Aug-2011"/>
                </LinearLayout>
                <LinearLayout 
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dip">
                    <ScrollView 
                        android:layout_width="fill_parent"
                        android:layout_height="125dip"
                        android:scrollbars="vertical|horizontal"
                        android:overScrollMode="ifContentScrolls">
                    <LinearLayout 
                        android:layout_width="fill_parent"
                        android:layout_height="125dip">
                        <WebView
                            android:id ="@+id/wvSmallDisc"
                            android:layout_width ="fill_parent"
                            android:layout_height ="125dip"
                            android:text = "11 Aug 2011"
                            android:scrollbars="horizontal|vertical"
                            />
                    </LinearLayout>
                </ScrollView>
                </LinearLayout>
                <View
                    android:layout_width ="wrap_content"
                    android:layout_height ="15dip"/>
                <LinearLayout 
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width ="wrap_content"
                        android:layout_height ="wrap_content"
                        android:text = "Kontakt"
                        android:layout_marginLeft="15dip"
                        style = "@style/txtcolor"/>
                    <TextView
                        android:layout_width = "fill_parent"
                        android:layout_height ="wrap_content"
                        android:text = "Global Personal Partner"
                        android:textColor = "#000"
                        android:textSize = "18dip"
                        android:layout_marginLeft="15dip"
                        style ="@style/txtcolor"/>
                    <ImageView 
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:src="@drawable/under"/>
                        <LinearLayout 
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:padding="4dip">
                            <TextView 
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:layout_weight="2"
                                android:textSize = "18dip"
                                android:layout_marginLeft="14dip"
                                android:text="Telefon :"
                                android:textColor="#000"/>
                            <TextView
                                android:id ="@+id/txtTelefone"
                                android:layout_width = "fill_parent"
                                android:layout_height ="wrap_content"
                                android:layout_weight="1"
                                android:text = "056 406 43 44 "
                                android:textColor = "#000"
                                android:textSize = "18dip"/>        
                    </LinearLayout>
                        <ImageView 
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:src="@drawable/under"/>
                            <LinearLayout 
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal"
                                android:padding="4dip"
                                >
                                <TextView 
                                    android:layout_width="fill_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="2"
                                    android:layout_marginLeft="14dip"
                                    android:textSize = "18dip"
                                    android:text="Fax :"
                                    android:textColor="#000"/>
                                <TextView
                                    android:id = "@+id/txtFax"
                                    android:layout_width = "fill_parent"
                                    android:layout_height ="wrap_content"
                                    android:layout_weight="1"
                                    android:text = "056 406 43 49"
                                    android:textColor = "#000"
                                    android:textSize = "18dip"/>        
                        </LinearLayout>
                        <ImageView 
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:src="@drawable/under"/>
            <LinearLayout 
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:padding="2dip">
                    <TextView 
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="14dip"
                        android:layout_weight="2"
                        android:textSize = "18dip"
                        android:text="E-Mail :"
                        android:textColor="#000"/>
                    <TextView
                        android:id = "@+id/txtemail"
                        android:layout_width = "fill_parent"
                        android:layout_height ="wrap_content"
                        android:layout_weight="1"
                        android:text = "solothurn@global-parner.ch"
                        android:paddingTop = "8dip"
                        android:textColor = "#22F"
                        android:textSize = "16dip"
                        android:linksClickable ="true"/>        
            </LinearLayout>
            <View 
                android:layout_width="fill_parent"
                android:layout_height="15dip"/>
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    <LinearLayout
        android:layout_width ="fill_parent"
        android:layout_height ="wrap_content"
        android:layout_weight = "0"
        android:orientation ="horizontal"
        >
            <Button
                android:id = "@+id/btnCall"
                android:layout_width ="fill_parent"
                android:layout_height ="fill_parent"
                android:layout_weight = "1"
                android:text="@string/call"
                android:textColor="#000"
                android:drawableTop = "@drawable/cal_icon_hoverl"/>
            <Button
                android:id = "@+id/btnMail"
                android:layout_width ="fill_parent"
                android:layout_height ="fill_parent"
                android:textColor="#000"
                android:layout_weight = "1"
                android:text="@string/mail" 
                android:drawableTop = "@drawable/mail_icon_hover"/>
            <Button
                android:id = "@+id/btnFa"
                android:layout_width ="fill_parent"
                android:layout_height ="fill_parent"
                android:textColor="#000"
                android:layout_weight = "1"
                android:text="@string/favorite"
                android:singleLine="true"
                android:drawableTop = "@drawable/favoriate_icon_hover"/>

  </LinearLayout>
</LinearLayout>

2 个答案:

答案 0 :(得分:0)

滚动视图中不能包含滚动视图。类似于在scrollview中有listview或gridview。他们根本就不滚动。所以我的建议是重新构建你的布局,以达到理想的行为。

答案 1 :(得分:0)

从file:///滚动网页似乎存在问题。 我想出的唯一解决方案是在本地网页中使用innercrolling。 为此我在http://cubiq.org/iscroll-4使用了可下载的修改过的脚本。 我做的唯一修改是在css中将页眉和页脚的高度和行高设置为0px。它有效。也许它对你有帮助。