Skip to content

Instantly share code, notes, and snippets.

@matsuyoro
Last active September 28, 2016 16:22
Show Gist options
  • Save matsuyoro/e6389db2adfa86d07f1b0f11b976c505 to your computer and use it in GitHub Desktop.
Save matsuyoro/e6389db2adfa86d07f1b0f11b976c505 to your computer and use it in GitHub Desktop.
fragmentのタブのアイコン画像のサイズをカスタマイズする ref: http://qiita.com/matsuyoro/items/48399411cca6764e051b
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerInside"
app:srcCompat="@drawable/ic_attachment_black_24dp"
android:tint="@color/colorBlack"
/>
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="32dp"
android:layout_height="32dp"
android:scaleType="centerInside"
android:src="@drawable/image_icon_line"
/>
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
tabLayout.getTabAt(0).setCustomView(R.layout.design_fragment_icon_camera);
tabLayout.getTabAt(1).setCustomView(R.layout.design_fragment_line_weight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment