[안드로이드 공부]/UI 50

The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant)

com.google.android.material.bottomappbar.BottomAppBar material 을 사용 할 때, material 테마를 적용 해주시 않으면 아래와 같은 에러가 나온다. The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant) layout.xml 과 style.xml에 아래와 같이 수정 해준다. 1. layout android:theme="@style/MaterialTheme" 2. style

Resource IDs will be non-final by default in Android Gradle Plugin version 8.0, avoid using them in switch case statements

switch 문에서 case R.id.xxxx 를 더 이상 제공 하지 않는다고 한다. 간단하게 if else 문으로 대체 하면 되는데 case 문이 많을 경우 난감하고 귀찮다. 이럴 때는 간단히 Refactoring 을 하면 된다. switch 에 커서를 올리고 Option(Windows Alt) + enter 를 치고 Replace switch with if 를 선택하면 한 방에 해결 된다.

viewpager 사용 시 하단 영역을 벗어날 경우

위와 같이 아래 영역을 넘어가게 되어 하단에 버튼등을 고정 시킬 경우 보이지 않는 문제가 발생한다. 1. viewpager의 marginBottom="?actionBarSzie" 로 하게 될 경우 버튼은 보이지만 스크롤 할 경우 같이 올라가며 하단 빈 영역이 보이게 된다. 2. Tab과 CollapsingToolbarLayout 를 사용 할 경우 다른 레이아웃으로 감싸주면 스크롤 범위가 영역과 맞아져저 해결은 되지만, 탭의 구성이 찌그러지게 된다. 즉, CoordinatorLayout 아래 다른 레이아웃으로 감싸면 안됨. 3. 원인은 app:layout_behavior="@string/appbar_scrolling_view_behavior" 뷰 페이저의 스크롤링을 적용했기 때문에 하단으로 더 길게 스크롤..

Actionbar Navigation icon 변경

Drawable drawable = ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_arrow_back_white_24dp); Overflow 아이콘 변경 toolbar.setOverflowIcon(drawable); 햄버거 모양 아이콘 변경 actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); Drawable drawable = ContextCompat.getDrawable(mContext,R.drawable.ic_arrow_back_white_24dp); actionBar.setHomeAsUpIndicator(drawable); 액티비티..