android-animation

Smooth animation between tabs when using selector - Android

荒凉一梦 提交于 2021-01-20 19:45:25
问题 I would like to get the background of the tab animated smoothly to the selected position (just like the default tabIndicator animates between tabs). Here is how my TabLayout looks like <android.support.design.widget.TabLayout android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tabLayout" app:tabBackground="@drawable/tab_selector" app:tabTextColor="@color/white" android:background="@drawable/tab_layout_bg" app

Smooth animation between tabs when using selector - Android

半腔热情 提交于 2021-01-20 19:44:58
问题 I would like to get the background of the tab animated smoothly to the selected position (just like the default tabIndicator animates between tabs). Here is how my TabLayout looks like <android.support.design.widget.TabLayout android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tabLayout" app:tabBackground="@drawable/tab_selector" app:tabTextColor="@color/white" android:background="@drawable/tab_layout_bg" app

How to restore transition state of MotionLayout without auto-playing the transition?

跟風遠走 提交于 2021-01-05 07:21:06
问题 My code Activity class SwipeHandlerActivity : AppCompatActivity(R.layout.activity_swipe_handler){ override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putBundle("Foo", findViewById<MotionLayout>(R.id.the_motion_layout).transitionState) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) savedInstanceState?.getBundle("Foo")?.let(findViewById<MotionLayout>(R.id.the_motion_layout)::setTransitionState) } } Layout <

How to restore transition state of MotionLayout without auto-playing the transition?

空扰寡人 提交于 2021-01-05 07:20:06
问题 My code Activity class SwipeHandlerActivity : AppCompatActivity(R.layout.activity_swipe_handler){ override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) outState.putBundle("Foo", findViewById<MotionLayout>(R.id.the_motion_layout).transitionState) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) savedInstanceState?.getBundle("Foo")?.let(findViewById<MotionLayout>(R.id.the_motion_layout)::setTransitionState) } } Layout <

How to swipe one row of RecyclerView programatically (at run time)?

半城伤御伤魂 提交于 2020-12-29 13:22:52
问题 I have a RecyclerView with items inside like this: I use ItemTouchHelper.SimpleCallback to listen for swipe and onChildDraw() to draw a canvas when items are swiped: A bit more swipe: My problem: I want to simulate a swipe (at run time) just on first item inside the list of items; I need first item to go (more or less ) -100 px on its X axis and then go back to original position. How to achieve this? 回答1: I created some utility method in case someone needs it import android.animation

customAnimation when calling popBackStack on a FragmentManager

旧城冷巷雨未停 提交于 2020-12-27 17:12:15
问题 In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_anomalie: Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content); if(contentFragment instanceof AnomalieListFragment) { getFragmentManager().popBackStack(); return true; } else {

customAnimation when calling popBackStack on a FragmentManager

余生颓废 提交于 2020-12-27 17:09:27
问题 In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_anomalie: Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content); if(contentFragment instanceof AnomalieListFragment) { getFragmentManager().popBackStack(); return true; } else {

customAnimation when calling popBackStack on a FragmentManager

十年热恋 提交于 2020-12-27 17:05:59
问题 In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_anomalie: Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content); if(contentFragment instanceof AnomalieListFragment) { getFragmentManager().popBackStack(); return true; } else {

customAnimation when calling popBackStack on a FragmentManager

只谈情不闲聊 提交于 2020-12-27 17:05:44
问题 In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_anomalie: Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content); if(contentFragment instanceof AnomalieListFragment) { getFragmentManager().popBackStack(); return true; } else {

customAnimation when calling popBackStack on a FragmentManager

放肆的年华 提交于 2020-12-27 17:05:39
问题 In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example. @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_anomalie: Fragment contentFragment = getFragmentManager().findFragmentById(R.id.content); if(contentFragment instanceof AnomalieListFragment) { getFragmentManager().popBackStack(); return true; } else {