在emulator中工作但在android设备中不工作的滚动视图

在emulator中工作但在android设备中不工作的滚动视图,android,android-layout,android-emulator,scrollview,Android,Android Layout,Android Emulator,Scrollview,我的应用程序中有一个滚动视图,在我的模拟器中运行良好,但在android设备中不起作用。。。。。我的应用程序是用minsdkversion:8开发的……我在android 2.2中部署了我的应用程序 我的布局如下 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:scrollbars="v

我的应用程序中有一个滚动视图,在我的模拟器中运行良好,但在android设备中不起作用。。。。。我的应用程序是用minsdkversion:8开发的……我在android 2.2中部署了我的应用程序

我的布局如下

<?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
 android:scrollbars="vertical" 
 android:layout_height="fill_parent" 
 android:layout_width="fill_parent"
 android:background="#D2691E"> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#D2691E"
>
<TextView  
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="Branch"
android:textColor="#000000"
android:textSize="30px"
/>
<Spinner android:id="@+id/group"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:prompt="@string/group_prompt"

/>   
<TextView  
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="Year"
android:textColor="#000000"
android:textSize="30px" />
<Spinner android:id="@+id/year"
    android:layout_width="match_parent"


 android:layout_height="wrap_content"
    android:drawSelectorOnTop="true"
    android:prompt="@string/year_prompt"

/>     

<Button android:id="@+id/ok1_button" 
         android:layout_height="wrap_content" 
         android:layout_width="wrap_content" android:text="Ok1" android:ems="5">          
</Button>
 </LinearLayout>
 </ScrollView>

请给出一个解决方案。谢谢你的2个狙击手将你的代码替换为

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#D2691E"
    android:scrollbars="vertical" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#D2691E"
        android:orientation="vertical" >

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Branch"
            android:textColor="#000000"
            android:textSize="30px" />

        <Spinner
            android:id="@+id/group"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="true"
            android:prompt="@string/stringone" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Year"
            android:textColor="#000000"
            android:textSize="30px" />

        <Spinner
            android:id="@+id/year"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="true"
            android:prompt="@string/stringtwo" />

        <Button
            android:id="@+id/ok1_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:text="Ok1" >
        </Button>
    </LinearLayout>
</ScrollView>
复制并粘贴到您的文件中。将在2.1和2.2中工作。

请尝试此代码

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">


     <ScrollView  
     android:scrollbars="vertical" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"
     android:background="#D2691E"> 
    <LinearLayout 
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#D2691E"
    >
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Branch"
    android:textColor="#000000"
    android:textSize="30px"
    />
    <Spinner android:id="@+id/group"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:prompt="@string/group_prompt"

    />   
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Year"
    android:textColor="#000000"
    android:textSize="30px" />
    <Spinner android:id="@+id/year"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:prompt="@string/year_prompt"

    />     

    <Button android:id="@+id/ok1_button" 
         android:layout_height="wrap_content" 
         android:layout_width="wrap_content" android:text="Ok1" android:ems="5">          
    </Button>
     </LinearLayout>
     </ScrollView>
    </LinearLayout>

设备上有什么问题?scrollview内的视图已冻结?@Rahul garg ya…..我无法在设备中滚动,但我可以在emulator上通过鼠标滚动按钮或拖动在模拟器中滚动cursor@kumar:检查我的答案是否在测试后更新。好的,你测试过我的答案了吗code@kumar:保存了整个文件,只需复制并粘贴到您的文件中。嘿,现在我已经为每个布局提供了xmlns:android=schemas.android.com/apk/res/android属性,但它正在工作……scrollview在我的上述代码中不工作的原因是什么好的,那么这可能是因为scrollview在您的设备中不允许作为父布局这可能是您选择该设备的原因正在使用