即使我使用正确的尺寸(hdpi,mdpi,xxhdpi …),选项卡上的图像图标也会显得非常小

我按照Google开发者页面上的指南来创建这5个文件夹,并用正确尺寸的图标填充它们:

在此处输入图像描述

我使用TabHost创建了我的标签,如下所示:

 TabHost tabHost = (TabHost) findViewById(R.id.tabHost); tabHost.setup(); TabHost.TabSpec spec1 = tabHost.newTabSpec("tab1"); spec1.setContent(R.id.tab1); spec1.setIndicator("", getResources().getDrawable(R.drawable.homeicon)); TabHost.TabSpec spec2 = tabHost.newTabSpec("tab2"); spec2.setContent(R.id.tab2); spec2.setIndicator("", getResources().getDrawable(R.drawable.startachainwhite48dp)); TabHost.TabSpec spec3 = tabHost.newTabSpec("tab3"); spec3.setContent(R.id.tab3); spec3.setIndicator("", getResources().getDrawable(R.drawable.joinachainwhite48dp)); TabHost.TabSpec spec4 = tabHost.newTabSpec("tab4"); spec4.setContent(R.id.tab4); spec4.setIndicator("", getResources().getDrawable(R.drawable.viewchainswhite48dp)); TabHost.TabSpec spec5 = tabHost.newTabSpec("tab5"); spec5.setContent(R.id.tab5); spec5.setIndicator("", getResources().getDrawable(R.drawable.profilewhite48dp)); tabHost.addTab(spec1); tabHost.addTab(spec2); tabHost.addTab(spec3); tabHost.addTab(spec4); tabHost.addTab(spec5); 

但由于某种原因,我的标签上的图标(在底部)显示很小

在此处输入图像描述

有没有人对此有解释/解决方案? 我觉得我在某个地方犯了一个愚蠢的错误 – 如果需要,会发布xml布局。 提前致谢。

编辑:可能值得一提的是,我在上面的代码中使用的getDrawable()方法已被弃用(API 22)

EDIT2:完整的XML布局

                          

为了确保每件事物看起来都符合您的预期,只需将图像添加到xxxhdpi文件夹中,并确保它们是192×192像素。

通过这种方法,您可以让OpenGL将图像转换为应用程序运行的设备,并且还可以在不丢失任何细节的情况下调整图像大小。

希望这会帮助你。
参考此处: https : //developer.android.com/guide/practices/screens_support.html