initEvent();
initAdapter();
return view;
}
public void initView() {
subjectArray = getContext().getResources().getStringArray(R.array.subjects);
tabHost = view.findViewById(android.R.id.tabhost);
}
public void initData() {
tabHost.addTab(tabHost.newTabSpec(“tab1”).setIndicator(subjectArray[0]).setContent(R.id.tab01));
tabHost.addTab(tabHost.newTabSpec(“tab2”).setIndicator(subjectArray[1]).setContent(R.id.tab02));
//设置 TabWidget 的布局参数
final TabWidget tabWidget = tabHost.getTabWidget();
// tabHost 选项卡改变的时候
tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
for(int i = 0; i < tabWidget.getChildCount(); i++) {
View tabView = tabWidget.getChildAt(i);
TextView tv= tabWidget.getChildAt(i).findViewById(android.R.id.title);
if(tabHost.getCurrentTab() == i) { // 选中
tabView.setBackgroundResource(R.drawable.tabhost_selected_true);
tv.setTextSize(14);
} else { // 未选中
tabView.setBackgroundResource(R.drawable.tabhost_selected_false);
tv.setTextSize(12);
}
}
}
});
for (int i = 0; i < tabWidget.getChildCount(); i++) {
View view = tabWidget.getChildAt(i);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view.getLayoutParams();
// 设置默认的选项卡背景颜色与字体大小
TextView textView = tabWidget.getChildAt(i).findViewById(android.R.id.title);
//view.setBackgroundColor(R.color.grey2);
textView.setTextSize(12);
// 设置第一个选项卡被选中时的样式
TextView tvDefault = tabWidget.getChildAt(0).findViewById(android.R.id.title);
tabWidget.getChildAt(0).setBackgroundResource(R.drawable.tabhost_selected_true);
tvDefault.setTextSize(14);
//获取tabs图片;
//ImageView iv=(ImageView)tabWidget.getChildAt(i).findViewById(android.R.id.icon);
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = 130;
layoutParams.weight = 0.0f;
}
}
public void initEvent() {
}
public void initAdapter() {
}
}
fragment_middle 代码如下:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:tools=“http://schemas.android.com/tools”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
tools:context=“.activity.MainActivity”>
<TabHost
android:id=“@android:id/tabhost”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:layout_alignParentLeft=“true”>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“horizontal” >
<TabWidget
android:id=“@android:id/tabs”
android:layout_width=“90dp”
android:layout_height=“match_parent”
android:orientation=“vertical”
android:gravity=“top”>
<FrameLayout
android:id=“@android:id/tabcontent”
android:layout_width=“match_parent”
android:layout_height=“match_parent” >
res/values/string.xml 中加入
语文
数学
选中的背景样式
文末
不管怎么样,不论是什么样的大小面试,要想不被面试官虐的不要不要的,只有刷爆面试题题做好全面的准备,当然除了这个还需要在平时把自己的基础打扎实,这样不论面试官怎么样一个知识点里往死里凿,你也能应付如流啊
小编将自己6年以来的面试经验和学习笔记都整理成了一个**937页的PDF,**以及我学习进阶过程中看过的一些优质视频教程。
其实看到身边很多朋友抱怨自己的工资很低,包括笔者也是一样的,其原因是在面试过程中没有给面试官一个很好的答案。所以笔者会持续更新面试过程中遇到的问题,也希望大家和笔者一起进步,一起学习。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
步,一起学习。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!