0
我正在尝试解剖和使用android碎片的这个例子。请原谅我张贴链接,但代码本身有点多,我不确定我应该在这里发布。使用android碎片数组
布局是相当直接:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<fragment class="conti.fragments.FragmentLayout$TitlesFragment"
android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent" />
<FrameLayout android:id="@+id/details" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent"
android:background="?android:attr/detailsElementBackground" />
</LinearLayout>
至于我能理解,显示在基本上是从第一阵列中的所有字符串列表左边,当你按下它时,它会在右边显示相应的订单文本。我如何添加一个菜单项来完成与显示右侧相应文本不同的菜单项?如果我想为这个新片段定义自己的布局,是否需要修改布局文件或创建一个新的布局文件?或者我必须在代码中以编程方式创建它?我有点困惑。
夸大自己的布局你可以改变你的公共静态类DetailsFragment扩展片段。在公共视图onCreateView(LayoutInflater inflater,ViewGroup容器, Bundle savedInstanceState){充气自己的布局 – eurosecom