您的位置:首页 > 其它

Tablayout 里面的tab 显示的时候靠近在一起的解决办法

2016-04-26 15:32 429 查看
在使用Tablayout 的时候,里面的tab 显示的时候靠近在一起的
解决办法 1:只要设置一个参数就可以了:app:tabGravity="fill"
<android.support.design.widget.TabLayout
android:id="@+id/recharge_tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@color/background"
app:tabIndicatorColor="@color/btn_blue"
app:tabIndicatorHeight="2dp"
app:tabGravity="fill"
android:layout_marginBottom="1dp">
如果第一种办法不能解决,很有可能超出了它的默认的宽度,这个时候设置最大的宽度就可以了.
解决办法 2:就是设置app:tabMinWidth="200dp",以及 app:tabMaxWidth="200dp"
	d="@+id/recharge_tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/btn_blue"
app:tabMinWidth="200dp"
app:tabMaxWidth="200dp"
>

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: