2015-09-23 40 views
0

我是初学者,在Android Studio中开发...我创建了2个选项卡和2个不同的活动。他们都有搜索功能。那么是否有可能在Android Studio中的1个布局中有2个活动?是否有可能在Android的1布局中有2个活动?

+0

你可以用碎片代替 –

+0

什么是碎片?对不起,我begginer –

+0

http://developer.android.com/intl/zh-tw/guide/components/fragments.html –

回答

1

创建两个活性activity1.java和activity2.java
然后在activity_main创建2个片段,并在通过他们的活动名称“安卓名”
<fragment android:name="com.example.activity1" android:id="@+id/fragment_place" android:layout_width="match_parent" android:layout_height="match_parent" />
<fragment android:name="com.example.activity2" android:id="@+id/fragment_place" android:layout_width="match_parent" android:layout_height="match_parent" />

相关问题