Android:更改选项卡标题文本大小
您好,我使用TabHost创建了滑动选项卡。这是我的密码 代码 SwipeActivity.java(主活动) 通过使用这段代码,我得到了如下输出 我想改变这段代码中的两件事Android:更改选项卡标题文本大小,android,android-tabhost,swipe,Android,Android Tabhost,Swipe,您好,我使用TabHost创建了滑动选项卡。这是我的密码 代码 SwipeActivity.java(主活动) 通过使用这段代码,我得到了如下输出 我想改变这段代码中的两件事 讨论和相机设置的对齐错误。为此,我想将此文本设置为单行(我尝试更改这些文本的文本大小,但未能做到这一点) 我收到的所有文字都是大写的。因此,我想将标题设置为原样(仅大写的第一个字母,其余全部小写) 像这样改变 TextView textview = (TextView) mTabHost.getTabWidget()
TextView textview = (TextView) mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title);
textview.setTextSize(25);
嗨,里亚兹·哈桑,我的要求不是那样。(我想更改文本大小以在一行中显示所有选项卡标题)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</TabHost>
</LinearLayout>
package com.app.swipeex;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class Tab1Activity extends Fragment{
View tab1;
@Override
@Nullable
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
tab1 = inflater.inflate(R.layout.tab1, container, false);
return tab1;
}
}
TextView textview = (TextView) mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title);
textview.setTextSize(25);