首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >改变TabbedPage的高度

改变TabbedPage的高度
EN

Stack Overflow用户
提问于 2021-12-29 09:30:20
回答 1查看 51关注 0票数 0

我为我的Tabbar创建了自定义呈现。现在我想增加身高。不知道我能在哪里换高度。因为文本被裁剪了。

在我的MainActivity.cs里

TabLayoutResource = Resource.Layout.CustomTabbar;

我的styles.xml

代码语言:javascript
复制
  <style name="CustomTab"
        parent="Base.Widget.Design.TabLayout">
    <item name="android:gravity">center</item>
    <item name="android:textSize">500sp</item>
    <item name="android:layout_height">wrap_content</item>
  </style>  

我的CustomTabbar.axml

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.TabLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_tabs"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:tabIndicatorColor="#FF3300"  
    app:tabTextAppearance="@style/CustomTab"
    app:tabMode="fixed" />

编辑:添加了minHeight,但标签没有显示为整体。

EN

回答 1

Stack Overflow用户

发布于 2021-12-29 09:41:12

您可以为android:minHeight设置一个TabLayout

TabLayout的代码供您参考。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.tabs.TabLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="200dp"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="#FF3300"
app:tabGravity="fill"
app:tabMode="fixed" />

更新:

更改:

代码语言:javascript
复制
app:tabMode="fixed" 

至:

代码语言:javascript
复制
 app:tabMode="scrollable" 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70517524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档