이렇게 TextView가 그 다음의 시간이 적혀있어야하는 위치까지 늘어나게 되어 시간이 보이지 않는 문제가 있음 이를 해결하기 위해서 는
<TextView
android:id="@+id/m5_tv_chat_msg_item_l_time"
style="@style/messageTimeText"
timeCheck="@{viewModel.timeCheck}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintWidth_default="wrap" //1
android:text="@{viewModel.time}"
app:layout_constraintBottom_toBottomOf="@id/m5_tv_chat_msg_item_l_msg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/m5_tv_chat_msg_item_l_msg" />
<TextView
android:id="@+id/m5_tv_chat_msg_item_l_msg"
android:layout_width="0dp" //2
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="3dp"
android:background="@drawable/m5_chatting_left_item"
android:paddingHorizontal="8dp"
android:paddingVertical="3dp"
android:text="@{viewModel.chatMsg}"
android:textColor="#000"
android:textSize="@dimen/initem_big"
app:layout_constraintWidth_default="wrap"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/m5_tv_chat_msg_item_l_time"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
textview의 길이가 좌우의 view의 제한을 받도록 0dp로 설정해주고
layout_constraintwidth_default 를 wrap으로 설정해 준다.
app:layout_constrainedWidth="true" 로 버전이 올라가면서 바뀌게 됐음.
※ 번외
찾는데 정말 오래걸렸는데 뷰가 아래의 시간과 같게되면 시간textview가 사라지면서 뷰의 길이가 달라지는 현상을 제거하기 위해서 그냥 GuideLine을 하나 더 추가해서 해결함 ㅋㅋ
'시행착오 저장소' 카테고리의 다른 글
activity가 여러번 반복해서 켜져서 하루 날렸던 후기 (0) | 2021.05.23 |
---|---|
android 프로젝트 시작하고 파이어베이스에 등록해보기 (0) | 2021.05.10 |
recyclerview 에서 item layout 크기가 scroll 마다 변경되는 문제 (0) | 2021.05.06 |
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/paging/PresenterCallback 해결 (0) | 2021.05.02 |
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind (0) | 2021.04.12 |