'How to InCrease or resize icon in tabitems in tablayout? in Android
I draw tablayout contains tabItems with icon I want to resize(Increase) Icon size How can I do???
first, I draw tablayout in xml and draw tabItems in tablayout second, I make selector(xml) use for tabItems, third, I make tab seletedListener in java class 4th, I linked selected event, and it works well But, has a problem icons size are too small
this is result enter image description here It looks so small this is xml
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBestTitle"
app:tabIndicatorColor="#004098"
app:tabIndicatorFullWidth="true"
app:tabIndicatorHeight="3dp"
app:tabMode="fixed"
app:tabSelectedTextColor="#004098"
app:tabTextAppearance="@style/TabLayoutTextStyle">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/selector_food_icon"
android:text="식품" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/selector_ship_icon"
android:text="조선" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/selector_steel_icon"
android:text="철강" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/selector_car_icon"
android:text="자동차" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/selector_electronic_icon"
android:text="전자" />
</com.google.android.material.tabs.TabLayout>
this is java class code
mBinding.tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
int TabPosition = tab.getPosition();
TabPos = TabPosition + 1;
readBEP("LIST", TabPos+"");
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
this is I want to enter image description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
