2010-12-17 48 views
0

我試圖做一個橫向的Android視圖滾動。但是,這不適用於我試過的任何設備。關於我在做什麼的任何想法都是錯誤的?這裏是我的標記:Android的滾動視圖不與橫向模式下的相對佈局

<ScrollView 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"> 
     <RelativeLayout 
     android:id="@+id/sample1" 
     android:gravity="top" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"> 
     <ImageView 
     android:src="@drawable/sample1" 
     android:layout_centerHorizontal="true" 
     android:layout_width="fill_parent" 
     android:padding="10dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="20dp"/> 
     </RelativeLayout> 
    </ScrollView> 
<LinearLayout android:id="buttons" 
xmlns:android="schemas.android.com/apk/res/android"; 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" 
android:layout_alignParentBottom="true" android:padding="3dp"> 
... 
</LinearLayout> 

更新:有一個額外的線性佈局被包含到這個視圖。我相信這可能是問題。有任何想法嗎?

+0

沒有什麼錯在你的XML看不見的蒼蠅,你爲什麼說,不以任何設備工作,也許你可以張貼的內容的logcat引發錯誤... – Franco 2010-12-17 02:02:09

+0

你能看看你的'res/layout-land/YOUR_FILE_NAME'中是否有'layout-land'文件,並且你對每個(縱向/橫向)模式有不同的佈局, – Samuel 2010-12-17 02:31:15

回答

0

這段代碼沒有問題。我用一個放置在mdpi可繪製文件夾中的768x1024 jpg試過了。你使用的圖像的分辨率是多少?你確定你的佈局中沒有嵌入TextViews或其他視圖嗎?

alt text

+0

我的錯誤。有一個線性佈局,其中包含一組按鈕,它們被包含在頁面的底部。 <的LinearLayout \t機器人:ID = 「按鈕」 \t的xmlns:機器人= 「http://schemas.android.com/apk/res/android」 \t機器人:layout_width = 「FILL_PARENT」 \t機器人:layout_height =」 wrap_content「 \t android:orientation =」horizo​​ntal「 \t android:layout_alignParentBottom =」true「 \t android:padding =」3dp「> – mdunkle 2010-12-17 18:21:06

相關問題