2014-12-13 2 views
1

기본적으로 listview와 button 인 relativelayout이 있습니다. 내 목록보기는 너비와 높이가 "match_parent"으로 설정됩니다. 그리고 내 버튼은 화면 하단에 layout_alignParentBottom = "true";으로 표시됩니다.ListView의 애니메이션보기

Google 크롬의 URL 표시 줄과 비슷한 효과를 얻고 싶습니다. 내 말은, 스크롤을 할 때 보이지 않는 버튼을 만들 수 있고 크롬처럼 스크롤 할 때 보이기를 원합니다.

onScroll() 메서드를 사용하여 목록보기를 덮어 쓰려고 시도했지만 TranslateAnimation()을 사용했지만 찾고있는 효과를 얻을 수 없습니다.

미리 감사

답변

0

에서 당신은 안드로이드에 대한 FloatingActionButton 라이브러리를 사용할 수 있습니다.
당신의 XML에 사용 :

<ListView 
     android:id="@android:id/list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

<com.melnykov.fab.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:layout_margin="16dp" 
     android:src="@drawable/ic_action_content_new" 
     fab:fab_colorNormal="@color/primary" 
     fab:fab_colorPressed="@color/primary_pressed" 
     fab:fab_colorRipple="@color/ripple" /> 

를 그런 다음 목록보기에 첨부 : 당신은 it.Like이를 숨기기에있는 ListView의 스크롤 리스너를 설정하고, 스크롤 방법을 쓸 필요가

ListView listView = (ListView) findViewById(android.R.id.list); 
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 
fab.attachToListView(listView); 
+0

정확히 내가 찾던 것은 아니지만 ... 어쨌든 감사드립니다. 희망을 갖고 누군가는 지금 내가 의미하는 바를 누릴 것이다. – fapps

+0

스크롤 이벤트에 반응하는 Android 플로팅 액션 버튼. 연결된 대상이 위로 스크롤되면 아래로 스크롤하면 보이지 않게됩니다. - 네가 원하는게 아니야? –

+0

네,하지만 정확한 방법은 아닙니다. 소재 디자인으로 업그레이드하지 않고 스타일을 혼합하고 싶지 않기 때문에 텍스트와 Holo 스타일의 버튼이 필요했습니다. – fapps

0

버튼을 누르십시오. 그러나 FileAfter가 true 인 동안 listview에 직접 TranslateAnimation을 구현할 수는 없습니다. 복잡한 문제가 발생할 것입니다.