2013-02-15 45 views
0

在我的應用我想有這樣的佈局:Android版式設計:按鈕上方的圖片上方的圖片。當鍵盤出現在我的佈局擰

First layout

我做了一個相對佈局持有的ImageView,TableLayout和一個按鈕。問題是,當我打開鍵盤修改EditText時,鍵盤位於EditText的頂部,因此用戶看不到他在寫什麼。我想要的佈局是這樣的,當顯示鍵盤:

Layout 2

用戶應該能夠向上滾動視圖以查看整個圖像同時顯示的鍵盤,即使他不那麼請參閱EditText,因爲他想將圖像的一些數據複製到EditTexts中。我試圖做這樣的:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:baselineAligned="false" 
android:orientation="vertical" > 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/buttonEditStop" 
    android:padding="10dip" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <ImageView 
      android:id="@+id/stopImg" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:clickable="true" 
      android:contentDescription="@string/entry_img" 
      android:onClick="ImageClick" /> 

     <TableLayout 
      android:id="@+id/formLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/stopImg" 
      android:layout_marginRight="10dp" > 

      ... 

     </TableLayout> 
    </RelativeLayout> 
</ScrollView> 

<ImageButton 
    android:id="@+id/buttonEditStop" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:contentDescription="@string/edit_stop" 
    android:onClick="EditButtonClicked" 
    android:src="@drawable/ic_menu_edit" /> 

使用此代碼我的整個佈局擰。我在圖像頂部看到了表單,接着是ImageButton,圖像應該在imageView中看到。

任何人都知道如何獲得我想要的佈局?

謝謝!

+0

你有重疊出現在鍵盤的時間? – 2013-02-15 11:20:50

+0

感謝您的評論,我發現android:windowSoftInputMode =「adjustPan」。我在清單中使用了它,儘管當鍵盤打開時我無法看到整個圖像,但現在我可以看到EditText,這對我來說已經足夠了。謝謝! – 2013-02-15 11:29:49

回答

2

要避免的EditText重疊的方式形成我在我的清單以使用

android:windowSoftInputMode="adjustPan" 

相關問題