簡體   English   中英

滾動視圖在模擬器中工作但在 android 設備中不工作

[英]Scroll view working in emulator but not working in android device

我的應用程序中有一個滾動視圖,它在我的模擬器中運行良好但在 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 個 Snippers 中,將您的代碼替換為

 <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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM