-1

何度も議論されていることを理解していますが、解決策を見つけることができません。 私はすべての色を特にマークしました。これはAlertDialogです。TextViewのフォントが水平線LinearLayoutで親の高さに一致しませんか?

enter image description here

なぜテキスト自体をトリミング?私は間違って何をしていますか?

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

    <LinearLayout 
     android:id="@+id/dialNewGroupCustomNameLay" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/customNameTextView" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.3" 
      android:gravity="left|center_vertical" 
      android:paddingLeft="10dp" 
      android:text="@string/group_custom_name_label" 
      android:textColor="@color/white" 
      android:textSize="15dp" /> 

     <EditText 
      android:id="@+id/newGrNameEditText" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="0.7" 
      android:textColor="@color/white" 
      android:textCursorDrawable="@null" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/dialNewGroupDefinedLangsLay" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_margin="3dp" 
      android:background="@color/white" /> 

     <LinearLayout 
      android:id="@+id/newGrDialLangFrom" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="0.6" 
      android:orientation="vertical"></LinearLayout> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_margin="3dp" 
      android:background="@color/white" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/newGrNameLay" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/purple" 
     android:orientation="horizontal" 
     android:paddingBottom="30dp" 
     android:paddingTop="10dp"> 

     <TextView 
      android:id="@+id/groupNameTextView" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.3" 
      android:background="@color/red" 
      android:gravity="left|center_vertical" 
      android:paddingLeft="10dp" 
      android:text="@string/group_name_label" 
      android:textColor="@color/white" 
      android:textSize="15dp" /> 

     <TextView 
      android:id="@+id/newGrNameTextView" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.7" 
      android:background="@color/green" 
      android:gravity="left|center_vertical" 
      android:paddingLeft="10dp" 
      android:paddingBottom="10dp" 
      android:text="@string/group_name_label" 
      android:textColor="@color/white" 
      android:textSize="17dp" /> 
    </LinearLayout> 

</LinearLayout> 

完全なXMLが追加されました。また、LinearLayoutがAlertDialogにあることを考慮する必要があります。

+0

TextViewsから 'android:paddingBottom =" 30dp "'を削除するだけです。さらに、実際に** 2 **ネストされたLinearLayout(パフォーマンスには悪い)は必要ありません。 **単一** RelativeLayoutはより効果的です。 –

+0

レイアウトを確認しました。それは私のシステムで正しく表示されています。あなたは完全なXMLを投稿できますか? – Nikhil

答えて

0

テキストの高さ+パディングはTeaxtbox(match_parent)の高さになります。

0

あなたのLinearLayoutはその子からその高さを取得します。

android:layout_height="wrap_content" 

をし、子供たちは親のLinearLayoutからの高さを取得します:

android:layout_height="match_parent" 

それは誤りです。実際に高さが指定されている場所が必要です。

+0

私は理解します、私の場合に修正する方法は? – JDev

+0

newGrNameLayLinearLayoutに 'android:layout_height =" 100dp "'を設定してみてください。 –

0

すべてのパディングとマージンのボトムとトップを削除しました。小さなビューを下に追加しました。

enter image description here

<View 
    android:layout_width="match_parent" 
    android:layout_height="10dp" 
    android:layout_margin="3dp"/> 

それは良く見えます。

関連する問題