2011-07-11 11 views
0

私のアクティビティには、1行のEditView、1つのマルチエディットビュー、1つのボタンがあります。 シングルラインEditViewの内部に長いテキストを入力すると、送信ボタンとともにフォーム全体が右に移動します。私はフォームを提出することができません。どうしたらいいですか?Android:EditViewが右に移動

おかげで、 nehatha

+++編集+++++++

<?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="wrap_content" 
android:background="@drawable/bg" android:orientation="vertical" 
android:id="@+id/rootView"> 
     <LinearLayout android:layout_width="fill_parent" 
    android:background="@color/Black" android:layout_height="1dip" /> 
     <ScrollView android:id="@+id/ScrollView01" 
    android:layout_width="fill_parent" android:layout_height="wrap_content"> 
       <LinearLayout 
       android:focusable="true" 
       android:focusableInTouchMode="true" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content">  
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:layout_gravity="center" android:layout_marginBottom="2dip" 
     android:paddingLeft="12dip" android:paddingRight="20dip" 
     android:paddingTop="15dip" android:stretchColumns="0"> 
     <TableRow android:layout_marginBottom="5dip"> 
      <ImageView android:id="@+id/img" 
       android:layout_width="270dip" android:layout_height="270dip"> 
      </ImageView> 
     </TableRow> 
     <TableRow android:layout_marginBottom="5dip"> 
      <EditText android:background="@android:drawable/editbox_background" 
       android:focusable="true" android:id="@+id/txtTitle" 
       android:hint="@string/hint_title" android:nextFocusDown="@+id/txtDesc" 
       android:imeOptions="actionNext" android:inputType="text" 
       android:textSize="6pt" android:layout_width="fill_parent" 
       /> 
     </TableRow> 

     <TableRow android:layout_marginBottom="5dip"> 
      <TextView android:padding="3dip" android:textSize="18dip" 
       android:textColor="@color/registration_fields_title" android:text="Description" /> 
     </TableRow> 

     <TableRow android:layout_marginBottom="5dip"> 
      <EditText android:background="@android:drawable/editbox_background" 
       android:focusable="true" android:gravity="top" android:inputType="textMultiLine" 
       android:minLines="5" android:id="@+id/txtDesc" 
       android:nextFocusDown="@+id/btn_update" android:imeOptions="actionDone" 
       android:textSize="6pt" android:layout_width="fill_parent" 
       /> 
     </TableRow> 
     <TableRow android:layout_marginBottom="5dip"> 
      <Button android:layout_width="wrap_content" 
       android:layout_gravity="center" android:layout_height="wrap_content" 
       android:textStyle="bold" android:textColor="@color/white" 
       android:clickable="true" android:background="@drawable/menu_button_border_shape" 
       android:layout_marginLeft="10px" android:text="Post" 
       android:id="@+id/btn_post"></Button> 

     </TableRow> 
    </TableLayout> 
    </LinearLayout> 
</ScrollView> 

答えて

0

その幅があるので、あなたがEditText(ないEditView)サイズのthatsに増加している場合"wrap_content"に設定します。以下のような絶対量に幅を設定してみてください:

android:layout_width="fill_parent" 

または

android:layout_width="100dip" 

wrap_contentは常にそれのコンテンツの幅になります。 layout_width = "fill_parent" 私のために働いていません。

+0

こんにちはコネティカット、アンドロイド(例えばfill_parentとして)のEditText幅を指定します。私はオリジナルの投稿を実際のレイアウトコードで編集しました。あなたは一度チェックできますか? –

+0

固定幅「300dip」を指定しても問題ありませんが、別の画面サイズではどのように動作しますか?正確な幅を指定する –

+0

は、別のデバイスで正しく動作させる方法がわからない限り、実際にはお勧めできません。私は本当にfill_parentを使用しようとします。あなたはそれが動作していないと言って、まさにそれは何ですか? –

0

+0

"fill_parent"が機能していないため、オリジナルの投稿を実際のレイアウトコードで編集しました。あなたは一度チェックできますか? –

+0

@Vencat TableRowにfill_parentを入れようとしました – barmaley

+0

アンドロイド:layout_width = "fill_parent"をTableRowに配置しましたが、レイアウトはまだ右に動いています。 –

0
//try following code 

//1)set height of your txtDesc id of EditText 
//using fix height 
android:id="@+id/txtDesc" 
    android:layout_height="70dp" 

//or 
//2) set height of your txtDesc id of EditText 
//using wrap_content height 
android:id="@+id/txtDesc" 
    android:layout_height="wrap_content"