아래 txt_content TextView의 라인 수에 따라 LinearLayout Height 조정 되게 하고 싶어서 찾아봤다.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:gravity="center"
>
<LinearLayout
android:layout_width="335dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constrainedHeight="true" <!-- 해당 옵션이 없으면 layout_constraintHeight_max동작하지 않습니다.-->
app:layout_constraintHeight_max="250dp" <!-- height의 최대 늘어나는 크기-->
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:padding="20dp"
android:background="@drawable/corner_round_layout">
<TextView
android:id="@+id/txt_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="타이틀"
android:gravity="center"
android:textColor="@android:color/black"
android:textSize="18dp" />
<TextView
android:id="@+id/txt_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="5dp"
android:text="안녕하세요. 다이알로그입니다.\n두줄입니다.\n세줄입니다."
android:gravity="center"
android:textColor="@android:color/black"
android:textSize="16dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal" >
<kr.kfcc.insurance.CustomUI.CustomButton
android:id="@+id/left_button"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:text="취소"
android:textSize="16dp"
android:textColor="#333333"
android:layout_marginRight="9dp"
android:fontFamily="@font/spoqahansansneo_bold"
app:corner_Radius="50dp"
app:stroke_Width="0dp"
app:border_Color_Start="#000000"
app:border_Color_End="#000000"
app:background_Color_Start="#DFE5E8"
app:background_Color_End="#DFE5E8"
/>
<kr.kfcc.insurance.CustomUI.CustomButton
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:id="@+id/right_button"
android:text="확인"
android:textSize="16dp"
android:textColor="#FFFFFF"
android:fontFamily="@font/spoqahansansneo_bold"
app:corner_Radius="50dp"
app:stroke_Width="0dp"
app:border_Color_Start="#000000"
app:border_Color_End="#000000"
app:background_Color_Start="#3074f0"
app:background_Color_End="#3074f0"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
'Android(Java)' 카테고리의 다른 글
[Java]WebView사용시 target=_blank 사용에 따른 onCreateWindow 호출되는 문제 (0) | 2024.04.12 |
---|---|
[Java] Log 가독성있게 찍기 (0) | 2024.04.08 |
[Java] AES(128,192,256)::iv 암복호화 (0) | 2024.03.29 |
[Java] 디바이스 정보가져오기[모델명,OS버전,Device ID] (0) | 2024.03.29 |
[Android] 금융권 안드로이드 프로젝트 내부망 세팅방법 (1) | 2024.03.29 |