我想底部对齐标签图标,但我不知道如何实现它:(我已经尝试过setCustomView
但没有成功。虽然我的自定义布局设置了宽度和高度,match_parent
但它不会填充整个标签,因此我不能底部对齐我的内容。
这里有两张图片来说明什么
我想实现
以及我实际得到的
这是自定义选项卡视图布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#f00">
<ImageView
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
</LinearLayout>
我为调试添加了红色背景。它实际上只显示在图标周围,而不是整个选项卡。
选项卡背景的 9-patch 图像为:
所以填充区域应该是整个图像......