Моя раскладка выглядит любит это:ConstraintLayout показывает плохое расположение на предварительном просмотре, даже если на план ОК
<android.support.v7.widget.CardView
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="wrap_content"
android:background="@color/silver"
>
<android.support.constraint.ConstraintLayout
android:id="@+id/newsListItemView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:id="@+id/ivImage"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="false"
android:scaleType="centerCrop"
android:src="@drawable/sample_picture"
app:layout_constraintHorizontal_bias="0.43"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_height="150dp">
</ImageView>
<ImageButton
android:id="@+id/btnLike"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_oval_vd_wrap"
app:layout_constraintBottom_toBottomOf="@+id/ivImage"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivImage"
app:srcCompat="@drawable/ic_hearth_off"/>
<TextView
android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="TextView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnLike"/>
<TextView
android:id="@+id/tvVotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:text="TextView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnLike"/>
<TextView
android:id="@+id/tvContent"
android:layout_width="288dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.52"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvDate"/>
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
Вот предварительный просмотр, как это выглядит:
Как вы можете видеть расположение на чертеже (справа) отображается правильно. При предварительном просмотре (также на реальном устройстве), например, кнопка (белая кнопка с подачей внутрь) имеет плохую позицию, даже если ее схема показана правильно. Как я могу это исправить? Это правильное поведение? Я использую бета-версию ConstraintLatout 4. Должен ли я сообщать об этом в Google?
Спасибо, Это была ошибка в библиотеке. Должно быть исправлено в следующей бета-версии. [сообщение отправлено в google] (https://code.google.com/p/android/issues/detail?id=231455) –
@LucyFair благодарит вас, можете ли вы пометить его решение для 50% -ной помощи – amorenew