TextView移到屏幕中间

时间:2018-11-09 16:55:38

标签: android xml textview

我遇到一个问题,当TextView's(ID为ImageView's和{{1}时,我的@+id/download_complete_indicator或我使用的AutoResizeTextView移到屏幕中间})开头是@+id/download_complete_indicator

这是我的visible

ItemView

在此图像的左侧,您可以看到我得到的结果,在右侧是<?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" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:tools="http://schemas.android.com/tools"> <android.support.v7.widget.CardView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="20dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent"> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <com.myAppName.Songplayer.Utils.AutoResizeTextView android:id="@+id/video_title" android:layout_width="220dp" android:layout_height="27dp" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="Title" android:textAppearance="@style/TextAppearance.AppCompat.Headline" android:textColor="@color/colorPrimaryTextDefaultMaterialLight" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/song_cost_layout_songlist" app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.052" /> <com.myAppName.Songplayer.Utils.AutoResizeTextView android:id="@+id/uploader_username" android:layout_width="220dp" android:layout_height="21dp" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="Artist" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textColor="@color/colorSecondaryTextDefaultMaterialLight" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/song_cost_layout_songlist" app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/video_title" app:layout_constraintVertical_bias="0.0" /> <com.myAppName.Songplayer.Utils.AutoResizeTextView android:id="@+id/song_duration" android:layout_width="81dp" android:layout_height="14dp" android:layout_marginStart="8dp" android:layout_marginTop="32dp" android:layout_marginBottom="8dp" android:text="Duration" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.95" app:layout_constraintStart_toEndOf="@+id/uploader_username" app:layout_constraintTop_toBottomOf="@+id/song_cost_layout_songlist" /> <ImageView android:id="@+id/download_indicator" android:layout_width="19dp" android:layout_height="15dp" android:layout_marginStart="8dp" android:layout_marginBottom="8dp" android:background="@drawable/song_download" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> <ImageView android:id="@+id/download_complete_indicator" android:layout_width="19dp" android:layout_height="15dp" android:layout_marginStart="8dp" android:layout_marginBottom="8dp" android:background="@drawable/song_download_complete" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> <android.support.constraint.ConstraintLayout android:id="@+id/song_cost_layout_songlist" android:layout_width="66dp" android:layout_height="17dp" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_marginTop="2dp" android:clickable="true" android:visibility="visible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" tools:ignore="RelativeOverlap"> <ImageView android:id="@+id/imageView_dialog" android:layout_width="33dp" android:layout_height="match_parent" android:layout_marginTop="2dp" android:layout_marginBottom="2dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" app:srcCompat="@drawable/silver_star_selected" /> <com.myAppName.Songplayer.Utils.AutoResizeTextView android:id="@+id/your_stars_share_dialog" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentEnd="true" android:layout_alignParentBottom="true" android:layout_marginStart="2dp" android:layout_marginTop="2dp" android:layout_marginBottom="2dp" android:text="2000" android:textColor="@color/main_app_color" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/imageView_dialog" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.428" /> </android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout> </android.support.v7.widget.CardView> <ImageView android:id="@+id/song_album_cover" android:layout_width="50dp" android:layout_height="50dp" android:layout_marginTop="14dp" android:layout_marginStart="12dp" android:elevation="2dp" app:srcCompat="@drawable/no_cover_art" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> 向我展示的设计:

enter image description here

0 个答案:

没有答案