安卓:我怎样才能改变图标的​​大小在操作栏标签? [英] Android: How can I change icons size in Action Bar Tabs?

查看:239
本文介绍了安卓:我怎样才能改变图标的​​大小在操作栏标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个操作栏选项卡活动我的项目。我用了3个标签和我加了一些图标。但是,图标显示在一个小尺寸,即使我下载了他们48dp。

I created an Action Bar Tabs activity for my project. I used 3 tabs and I added some icons. But the icons are shown in a small size, even if I downloaded them in 48dp.

在这里输入的形象描述

我的code是:

<android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />


final private int[] tabIcons = {
        R.drawable.ic_photo_library,
        R.drawable.ic_chat,
        R.drawable.ic_people
};

private void setupTabsIcons() {

    tabLayout.getTabAt(0).setIcon(tabIcons[0]);
    tabLayout.getTabAt(1).setIcon(tabIcons[1]);
    tabLayout.getTabAt(2).setIcon(tabIcons[2]);

}

我怎么能更改的图标的大小?我也有一个FloatingActionButton同样的问题。它里面的图标是很小的。

How could I change the size of the icons? I also have a FloatingActionButton with the same problem. The icon inside it is small.

推荐答案

只需添加标签,你的自我。

Just add Tab you self.

TabLayout layout = new TabLayout(TestActvt.this);
View view = getLayoutInflater().inflate(R.layout.custom,null);
view.findViewById(R.id.img).setImageResource(R.drawable.img);
TabLayout.Tab tab = layout.newTab().setCustomView(view);
layout.addTab(tab);

FloatingActionButton只有2大小:在其中小型或正常和Iamge有固定尺寸

FloatingActionButton only has 2 size : mini or normal and Iamge in them has fixed size.

这篇关于安卓:我怎样才能改变图标的​​大小在操作栏标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆