방명록
- [Android] Databinding Format Character2023년 10월 02일 19시 20분 09초에 업로드 된 글입니다.작성자: 핀수728x90반응형
데이터바인딩에서도 형식 문자를 이용해 값을 나타낼 수 있다.
string.xml
<string name="forecast_time">%s시</string>
layout.xml
android:text="@{String.format(@string/forecast_time, hourlyForecast.time)}"
<TextView android:id="@+id/item_time" android:layout_width="0dp" android:layout_height="wrap_content" android:textAlignment="center" android:text="@{String.format(@string/forecast_time, hourlyForecast.time)}" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="9"/>
공부하며 작성된 글이라 잘못된 정보가 있을 수 있습니다.
말씀해주시면 수정하겠습니다. 감사합니다.
References
How do I use databinding to combine a string from resources with a dynamic variable in XML?
I have a TextView which has a hardcoded string and I have a dynamic variable that I want to put at the end of this string. This is my code: <LinearLayout android:layout_width="match_parent...
stackoverflow.com
728x90반응형'pinslog > Log.daily()' 카테고리의 다른 글
[Android] Dialog 외부 영역 터치 가능하도록 설정하기 (0) 2023.10.08 [Android] 제약조건 프로그래밍 방식으로 변경하기 | How to move constraint programmatically (0) 2023.10.03 [Android] 프로젝트 셋팅을 하며 생긴 오류 해결하기 (0) 2023.10.01 Crashlytics 추가하기 (0) 2023.09.24 [etc.] Xcode에 GitHub remote 추가하기 | GitHub access token 발행하기 (0) 2023.01.18 다음글이 없습니다.이전글이 없습니다.댓글