2012-09-01 25 views
0

我有一個列表視圖包含的EditText和其他組件 的時候我就EditText上點擊,鍵盤彈出導致列表視圖進入它 底部和EditText上清除任何文本固定的佈局時,鍵盤會彈出

任何主意固定佈局或解決這個問題

Item.xml

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

    <TextView 
     android:id="@+id/t" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="7dip" 
     android:paddingTop="7dip" 
     android:text="Mate name" 
     android:textSize="20dip" > 
    </TextView> 

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/n" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:drawablePadding="0dip" 
      android:drawableRight="@drawable/icon_name" /> 

     <EditText 
      android:id="@+id/eventname" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toLeftOf="@+id/n" > 
     </EditText> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/t" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="7dip" 
     android:paddingTop="7dip" 
     android:text="Match friend" 
     android:textSize="20dip" > 
    </TextView> 

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/buttonpartner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:drawablePadding="0dip" 
      android:drawableRight="@drawable/icon_friend" /> 

     <EditText 
      android:id="@+id/editpartner" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toLeftOf="@+id/buttonpartner" > 
     </EditText> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/t3" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="7dip" 
     android:paddingTop="7dip" 
     android:text="Start Mate date" 
     android:textSize="20dip" > 
    </TextView> 

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/d" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:drawablePadding="0dip" 
      android:drawableRight="@drawable/icon_cal" /> 

     <EditText 
      android:id="@+id/editd" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toLeftOf="@+id/d" > 
     </EditText> 
    </RelativeLayout> 

addevent.xml

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

    <ListView 
     android:id="@+id/MyList" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:descendantFocusability="beforeDescendants" 
     > 
    </ListView> 

</LinearLayout> 

回答

2

您可以將應用程序設置爲全屏模式。當你這樣做時,即使彈出鍵盤,元素也是固定的。

我的一個例子theme.xml文件:

<style name="theme_loading" parent="android:Theme"> 
    <item name="android:windowBackground">@drawable/loading</item> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowFullscreen">false</item> 
    <item name="android:textSize">14sp</item> 
    <item name="android:textColor">@color/textOptionsColor</item> 
    <item name="android:radioButtonStyle">@style/rbStyle</item> 
    <item name="android:buttonStyle">@style/ButtonStyle</item> 
</style>