如何在多于一个部分分割屏幕
答
斯普利特Android的活动,您应该使用片段劈裂屏幕的任何建议,将不胜感激谢谢面临的问题RTMP网址这个类允许你动态地显示多个任务。你可以使用片段类。
步骤: 1.创建片段级
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.ViewGroup;
public class yourFragmentName extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.article_view, container, false);
}
}
-
在您的活动创建的FrameLayout要展示的片段。
<FrameLayout android:id="@+id/your_placeholder" android:layout_width="match_parent" android:layout_height="match_parent"> </FrameLayout>
-
在主要活动,添加此布局片段
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // Replace the contents of the container with the new fragment ft.replace(R.id.your_placeholder, new FooFragment()); // or ft.add(R.id.your_placeholder, new FooFragment()); // Complete the changes added above ft.commit();
- 对于第二个片段也重复同样的。
有关详细说明,请参阅,https://guides.codepath.com/android/Creating-and-Using-Fragments
答
随着碎片的帮助,您可以缝在屏幕分成多个部分,每一个都有其自己的UI
欢迎计算器!请花些时间阅读[帮助页面](http://*.com/help),尤其是名为[“我可以问些什么话题?”]的章节(http://*.com/help/)讨论话题)和[“我应该避免问什么类型的问题?”](http://*.com/help/dont-ask)。请参阅[tour](http://*.com/tour)并阅读[如何提出良好问题](http://*.com/help/how-to-ask)。最后,请学习如何创建[最小,完整和可验证示例](http://*.com/help/mcve)。 – Markus