android-fragments - 片段无法加载
问题描述
所以我尝试制作一个带有导航抽屉的抽屉,长话短说,在活动中,我试图放入其中的片段不会在运行时加载。我的 navdraweractivity.class 中的片段代码如下所示:
Fragment fragment = new startingfragment();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.content_frame, fragment);
ft.commit()
我的片段布局的一部分如下所示:
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".startingfragment">
任何可能的原因和任何可能的解决方案?
解决方案
推荐阅读
- swift - 如何跨步遍历数组?
- r - 从 bigrquery 和 dbplyr 生成的 BigQuery 的优化?
- reflection - 如何设计一个可以根据其中一个值排序的地图?
- javascript - jquery 在我试图抓取的 div 元素的 id 上获得“未定义”
- python - 字典列表作为字典列表键的值
- css - 如何动态存储一些css,字体样式文件到反应的公用文件夹?
- arrays - 我想使用临时数组进行数组旋转,下面是它的代码?有没有更好的方法使用临时数组来做到这一点?
- excel - 用于存储工作表名称的动态数组
- mysql - 如果字段不存在,则向字段添加值
- javascript - 从更改事件中触发更改事件