2016-11-16 2 views
0

Die Vorschau in Android Studio nicht Vorschau überein, ist dies:Constraint-Layout: Button Höhe

enter image description here

Die Schaltfläche Höhe gut aussieht.

die gleiche Seite in meinem Handy Dies ist jedoch:

enter image description here

Die Höhe der Schaltfläche von dem unterscheidet, was ich im Android Studio Vorschau sah. Warum? Hier

ist die xml:

activity_chat.xml:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="ocm.my.chat.View.ChatActivity"> 

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

     <android.support.v7.widget.Toolbar 
      android:id="@+id/chat_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      android:title="fsdasdfsda" 
      android:layout_weight="1"/> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_chat"/> 


</android.support.design.widget.CoordinatorLayout> 

content_chat.xml:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent" 
              android:layout_height="match_parent" 
              app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    > 


    <EditText 
     android:id="@+id/msg_type" 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     android:layout_marginBottom="8dp" 
     android:layout_marginEnd="8dp" 
     android:layout_marginStart="8dp" 
     android:layout_marginTop="8dp" 
     android:hint="Input message" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toLeftOf="@+id/btn_chat_send" 
     app:layout_constraintTop_toBottomOf="@+id/list_msg" 
     tools:layout_constraintBottom_creator="1" 
     tools:layout_constraintLeft_creator="1" 
     tools:layout_constraintRight_creator="1" 
     tools:layout_constraintTop_creator="1"/> 

    <Button 
     android:id="@+id/btn_chat_send" 
     android:layout_height="0dp" 
     android:layout_marginBottom="8dp" 
     android:layout_marginTop="8dp" 
     android:background="@color/background_floating_material_dark" 
     android:text="Send" 
     android:textColor="@color/background_material_light" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/list_msg" 
     tools:layout_conversion_absoluteHeight="47dp" 
     tools:layout_conversion_absoluteWidth="106dp" 
     tools:layout_conversion_absoluteX="262dp" 
     tools:layout_conversion_absoluteY="447dp" 
     android:layout_width="106dp"/> 

    <ListView 
     android:id="@+id/list_msg" 
     android:layout_width="0dp" 
     android:layout_marginEnd="8dp" 
     android:layout_marginStart="8dp" 
     android:layout_marginTop="8dp" 
     android:divider="@null" 
     android:listSelector="@android:color/transparent" 
     android:transcriptMode="alwaysScroll" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" 
     tools:layout_constraintLeft_creator="1" 
     tools:layout_constraintRight_creator="1" 
     android:layout_height="450dp"/> 

</android.support.constraint.ConstraintLayout> 

Zusatz


Ich fand, dass, wenn ich meine Telefon und der ph. meines Freundes eine der Schaltflächengröße ist anormal, während es normal auf Emulator ausgeführt wird.

+0

haben Sie versucht mit min: Höhe & max: Höhe? – zerocool

+0

Es scheint, dass Sie der 'ListViw' eine feste Höhe geben, so dass die Schaltfläche den verbleibenden Platz zu ihrer Höhe nimmt. – shhp

Antwort

0

Die Höhe von ListView ist fix, und die Höhe der Schaltfläche hängt von der Höhe ListView ab. In einem anderen Bildschirm wird es anders angezeigt.

Verwandte Themen