Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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