AppBarLayout 안에 LinearLayout의 빨간색으로 옵션을 지정하면 해당 영역 만큼 스와이프로 숨길 수 있음
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/search_drawable"
app:layout_scrollFlags="scroll|enterAlways">
</android.support.design.widget.AppBarLayout>
코드에서 제어하기 위해서는
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id. appBarLayout);
LinearLayout layout = (LinearLayout) findViewById(R.id. layout);
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) layout.getLayoutParams();
선언 후 appBarLayout을 찾아온 후
params.setScrollFlags(0)을하면 스크롤을 해도 숨겨지지 않는다 반대로
params.setScrollFlags(1)로 적용하면 원래의 기능을 사용할수 있음
'android' 카테고리의 다른 글
CallBack만들기 (0) | 2017.11.29 |
---|---|
TextView Ellipsis 상태인지 아닌지 확인하는 방법 (0) | 2017.11.27 |
recyclerview scroll 정보 가져오기 (0) | 2017.11.22 |
shape 백그라운드 컬러 다이나믹하게 적용하기 (0) | 2017.11.14 |
문자, 전화 intent (0) | 2017.11.13 |