android - 如何在选项卡的布局中添加布局

标签 android layout tabs android-linearlayout

<分区>

我希望能够得到类似于 this.. 的东西

我希望能够在选项卡内添加 TextView ... 这必须动态完成......就像在另一个 Activity 中单击添加按钮时一样, TextView 应该与此类似对齐,并且应该在此处添加来自该表单的数据...... 请告诉我如何通过代码完成此操作。 如何将此特定格式或布局的 TextView 添加到选项卡?

最佳答案

它看起来像一个 Tab 中的简单 ListView。

因此您创建了 TabActivity,它将添加一堆选项卡,然后在每个选项卡上您可以添加不同的 Activity 并使用数据填充 Activity 。

TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec tabSpec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab

// Do the same for the other tabs
intent = new Intent().setClass(this, SomeActivity.class);
tabSpec = tabHost.newTabSpec("tabname").setIndicator("TabName").setContent(intent);
tabHost.addTab(tabSpec);

关于android - 如何在选项卡的布局中添加布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9896897/

相关文章:

emacs - Emacs选项卡的全局配置

jquery - 如何不显眼地防止 jQuery onload 闪烁?

android - 单击时如何更改 GridView 中的图像

java - 我正在尝试创建一个点击监听器,一旦点击它就会打开一个新 Activity

java - 以编程方式而不是 xml 方式包含时无法获得相同的 View

CSS:在底部设置动态高度标题和内容区域的最佳方式

sql-server - SQL 拆分制表符分隔列

Android Alarm Manager 与 4.4.x 不一致。支持 minSDKVersion 9 和 targetSdkVersion 21 的替代解决方案是什么

Android 地理围栏(多边形)

java - 调用 DatePickerDialog.getDatePicker() 时出现 NullPointerException