2010-12-09 89 views
2

大家好 我米制作的Android 2.2的 它的佈局應用程序有線性佈局一些文本字段,還有一些圖像按鈕在頁面的底部。 它在縱向視圖上的視圖是完美的,但現在當我通過按CTRL + F11轉到橫向視圖時,底部的圖像按鈕不顯示。僅僅因爲橫向上的屏幕大小與縱向不同。Android的橫向和縱向模式變化

我想要的是請引導我通過代碼,如果我的手機轉到橫向模式,它會檢查其模式並更改按鈕的位置,以便圖像按鈕應可見。

請請請朋友幫我在這..

等待烏拉圭回合的積極響應和指導..提前

在項目的資源

回答

3

感謝文件夾中創建一個名爲「佈局土地」子文件夾。將您的protrait佈局xml文件複製到該文件夾​​並根據您的地形需求進行編輯。現在每次更改設備的方向時都會自動調整佈局。那麼簡單

+0

Thnks Steff,我想知道android會自動讀取橫向模式下的layout-land文件夾,或者我需要明確地幫助android,以便它可以進入橫向視圖的該文件夾。請回復 – Shah 2010-12-09 10:27:51

+0

非常感謝兄弟們的工作...... – Shah 2010-12-09 12:16:17

2

除了@Steff推薦的內容之外,讓我補充一點。創建layout-land文件夾並創建XML之後,可以考慮在ScrollView中封裝佈局元素。我有類似的問題,這個解決方案對我來說非常合適。下面的代碼片段:

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal" 
    android:layout_weight="1" > 
    <ScrollView 
     android:id="@+id/ScrollView01" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" > 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:padding="3dp" > 
       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:textStyle="bold" 
        android:text="NAME" 
        android:padding="3dp" 
        android:textColor="#666666" 
        android:textSize="16sp" > 
       </TextView> 
       <TextView 
        android:text="Name" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/summaryContactName" 
        android:padding="3dp" 
        android:textColor="#111111" 
        android:textSize="17sp" > 
       </TextView> 
      </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

所有你把滾動型下的元素將確保屏幕內容不會切斷。

希望它有幫助。