2017-07-17 10 views
2

この場所をタッチすると、EditTextでMy TextInputLayoutが減少しています。
私はこの同じサイズのEditTextが必要な場合は何を修正すべきか、スクリーン上にキーボードを追加する必要があるのか​​2つの質問があります。ユーザータッチでTextInputLayoutが減少しています

enter image description here

のxml:あなたの最初の質問のための

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/linearLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context="pl.xd.hello.WeatherActivity"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="6" 
     android:orientation="horizontal"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:orientation="horizontal"> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="Podaj miejscowość" /> 
      </android.support.design.widget.TextInputLayout> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="4" 
      android:gravity="center" 
      android:orientation="horizontal"> 

      <android.support.design.widget.FloatingActionButton 
       android:id="@+id/floatingActionButton" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:clickable="true" 
       app:backgroundTint="@android:color/holo_red_dark" 
       app:fabSize="mini" 
       app:srcCompat="@drawable/ic_check_circle_black_24dp" /> 
     </LinearLayout> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:orientation="horizontal"> 

     <ListView 
      android:id="@+id/weatherListView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </LinearLayout> 
</LinearLayout> 

答えて

1

あなたが追加する必要があります2番目の質問について親のサイズ

<android.support.design.widget.TextInputLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 
<EditText 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:hint="Podaj miejscowość" /> 
</android.support.design.widget.TextInputLayout> 

でそれを修正するには、以下のようなあなたのEditTextを作りますAndroidManifest.xmlファイル内でのあなたのアクティビティへのandroid:windowSoftInputMode="stateAlwaysVisible"以下E:これはあなたの全体のアプリのためのsoftkeyboardを開くでしょう

<activity android:name=".MainActivity" 
android:label="@string/app_name" 
android:windowSoftInputMode="stateAlwaysVisible" /> 

、 あなたはより多くの情報のためthis postを見てみることができます。 いますが、これだけactivityまたはfragmentのためのキーボードを開きたい場合は、以下のように手動でキーボードを開くためのメソッドを追加することができます。

public static void showKeyboard(EditText editText) { 

    if (editText != null) { 
     InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
     imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); 
    } 
} 
+0

wrap_contentへmatch_parentからの変更は、エディットテキストは、まだタッチした後に低下している何の助けを、なかった – philips

+0

もし私が体重を変えたら、ちょうど場所がありますが、とにかくサイズが変わっています。 – philips

+0

"体重"が増減しても差はありません。いつも変わってしまいます。( – philips

関連する問題