我有一个带有选项卡的视图。在每个选项卡内,我正在创建另一个视图。
因此,包含选项卡的视图是在与用于在选项卡内创建视图的活动不同的活动上创建的。
如何从主要活动访问放置在选项卡视图内的 EditTextView 的文本?
我有一个带有选项卡的视图。在每个选项卡内,我正在创建另一个视图。
因此,包含选项卡的视图是在与用于在选项卡内创建视图的活动不同的活动上创建的。
如何从主要活动访问放置在选项卡视图内的 EditTextView 的文本?
您可以使用TabHost.TabSpec .setIndicator(label) 自定义选项卡的内容。
选项卡布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" >
    <TextView android:id="@+id/title" />
</RelativeLayout>
如何实现(示例片段)
// For each record I have, I want to display a Tab. 
for (Record r: myRecords) {
     setupTab(new TextView(mContext), r);
}
private void setupTab(final View view, final Record record) {
    TabSpec tabSpec = mTabHost.newTabSpec(..ID..);
    tabSpec.setContent(new TabContentFactory() {
    public View createTabContent(String tag) {
        return view;
    }
    });
    View tabIndicator = LayoutInflater.from(mTabHost.getContext()).inflate(R.layout.tab_layout, null);
    // Find you TextView by ID and alter it.
    ((TextView) tabIndicator.findViewById(R.id.title)).setText(record.getTitle());
    // Set is as indicator
    tabSpec.setIndicator(tabIndicator);
    // Add it to the TabHost
    mTabHost.addTab(tabSpec);
}