2016-11-16 17 views
0

プレビューが一致していませんが、このです。制約レイアウト:ボタンの高さがよく見えます</p> <p><a href="https://i.stack.imgur.com/rZ8s9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rZ8s9.png" alt="enter image description here"></a></p> <p>:ボタンの高さは、Android Studioでプレビュー

しかし、自分の携帯電話でも同じページがこれです:

enter image description here

ボタンの高さは、私は、Android Studioのプレビューで見たものとは異なっています。どうして?ここで

は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> 

追加


私は私を使用する場合ことがわかりました電話と私の友人のph 1つはボタンサイズが異常ですが、エミュレータでは正常です。

+0

あなたはmin:Height&max:Heightを使ってみましたか? – zerocool

+0

'ListViw'に固定された高さを与えて、ボタンが残りのスペースをその高さにするようにしているようです。 – shhp

答えて

0

高さはListViewで修正され、ボタンの高さはListViewの高さに依存します。だから、別の画面でそれは異なって表示されます。

関連する問題

 関連する問題