简体   繁体   中英

How to navigate in Tab Application in Android?

嗨,大家好,我是android技术的新手。我想问一下我在项目中的第四个标签中是否有4个标签。点击项目时,它应该导航到新活动,它还必须显示与之相关的其余3个标签,但是当单击它时,它正在单独显示活动,而没有显示剩余的3个选项卡..我该如何克服这个问题?有人可以事先帮助我吗?

You can use ViewStub to simulate differents Activities:

http://developer.android.com/reference/android/view/ViewStub.html

I did it this way.

The idea is implements in the stub the view that simulate your new activity.

<ViewStub
        android:id="@+id/myStub"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inflatedId="@+id/layoutParent"
        android:layout="@layout/new_activity" />

when the ViewStub is active hide the actual Layout:

myStub = findViewById(R.id.myStub);
myStub.setVisibility(View.VISIBLE);

In this moment I can find the new views in the new_activity layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM