Skip to content

Instantly share code, notes, and snippets.

View siscofran999's full-sized avatar
🌴
Sans Boy

Fransisco siscofran999

🌴
Sans Boy
  • Jakarta, Indonesia
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@color/colorBg">
<View
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/selector_tab_second"/>
<item android:state_selected="false" android:drawable="@drawable/unselector_tab"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- radius should be half of the desired TabLayout height -->
<corners
android:radius="15dp"/>
<!-- color of the selected tab -->
<solid
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- radius should be half of the desired TabLayout height -->
<corners
android:radius="15dp"/>
<!-- color of the selected tab -->
<solid
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorBg">#202125</color>
<color name="colorText">#7e8186</color>
<color name="colorTextSelected">#379477</color>
<color name="colorBgTabSelected">#043d2e</color>
<color name="transparent">#00000000</color>
</resources>
val tabs = tabLayout.getChildAt(0) as ViewGroup
for (i in 0 until tabs.childCount - 1) {
val tab = tabs.getChildAt(i)
val layoutParams = tab.layoutParams as LinearLayout.LayoutParams
layoutParams.marginEnd = dpToPx(resources, 8f).toInt()
layoutParams.marginStart = dpToPx(resources, 8f).toInt()
tab.layoutParams = layoutParams
tabLayout.requestLayout()
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/toggleSwitch"
android:layout_width="wrap_content"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<ImageView
android:id="@+id/card_man"
android:layout_width="121dp"
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:duration="0" />
<objectAnimator
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:valueFrom="0"
android:valueTo="180"
android:propertyName="rotationY"
android:duration="1500" />
<objectAnimator
android:valueFrom="1.0"