Android高级界面设计2
来源:互联网 发布:大数据平台对比分析 编辑:程序博客网 时间:2024/05/22 20:32
1.选项卡
activity_main.xml 中
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" > </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" > </FrameLayout> </LinearLayout> </TabHost>
添加文件 tab.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/linearLayout01" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="123456" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="456789" /></LinearLayout>
添加文件tab1.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/linearLayout02" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="asdfgh" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="zxcvbn" /></LinearLayout>
MainActivity.java 中
public class MainActivity extends Activity {private TabHost tabhost=null; @Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);tabhost = (TabHost)findViewById(android.R.id.tabhost);tabhost.setup();LayoutInflater inflater = LayoutInflater.from(this);inflater.inflate(R.layout.tab, tabhost.getTabContentView());inflater.inflate(R.layout.tab1, tabhost.getTabContentView());tabhost.addTab(tabhost.newTabSpec("tab").setIndicator("未接来电").setContent(R.id.linearLayout01));//添加第一个标签页tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("已接来电").setContent(R.id.linearLayout02));//添加第二个标签页}}
2.图片浏览器
点击 https://github.com/Caption-He/android_picture_wall
阅读全文
0 0
- Android高级界面设计2
- Android高级界面设计1
- Android学习基础篇——高级界面设计(二)
- android UI界面设计(2)
- android界面设计
- Android界面设计
- 界面设计2
- Android界面设计工具droiddraw
- Android 界面设计工具 droiddraw
- android界面设计工具
- Android界面设计工具droiddraw
- Android 应用界面设计
- Android 应用程序界面设计建议
- Android界面设计更easy
- android界面设计更easy
- Android开发UI界面设计
- Android之实例界面设计
- Android界面设计原则
- C语言:数组与函数实践
- [py]tornado-jquery ajax
- 基于信息增益的决策树归纳的Python实现【CD4.5算法】
- 使用onSavedInstanceState( )方法在活动被回收前保存数据
- 网页json解析 字典内数组
- Android高级界面设计2
- 数据库SQL之DML语句的使用
- 分页插件PageHelper
- 操作系统:内存管理(概念)
- RabbitMQ-官方指南
- 百度地图的开发版sha1和发布版sha1的获取方式
- 欢迎使用CSDN-markdown编辑器
- 【原创】Selenium学习系列之(三)—Selenium基本命令
- 通过正极点的平均值对偏移正极点进行拟合