Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我的偏好片段上有一个缺口,不知道是什么原因造成的_Android_Kotlin_Layout_Settings_Preferencescreen - Fatal编程技术网

Android 我的偏好片段上有一个缺口,不知道是什么原因造成的

Android 我的偏好片段上有一个缺口,不知道是什么原因造成的,android,kotlin,layout,settings,preferencescreen,Android,Kotlin,Layout,Settings,Preferencescreen,我按照这个指南创建了我的首选项页面,但是当我导航到我的设置页面时,我的设置片段中有一个空行,就在首选项屏幕项目之前,如图中所示 这是我的密码 类设置活动:AppCompatActivity(){ 重写创建时的乐趣(savedInstanceState:Bundle?){ super.onCreate(savedInstanceState) 支持碎片管理器 .beginTransaction() .replace(R.id.settings\u容器,SettingsFragment()) .com

我按照这个指南创建了我的首选项页面,但是当我导航到我的设置页面时,我的设置片段中有一个空行,就在首选项屏幕项目之前,如图中所示

这是我的密码

类设置活动:AppCompatActivity(){
重写创建时的乐趣(savedInstanceState:Bundle?){
super.onCreate(savedInstanceState)
支持碎片管理器
.beginTransaction()
.replace(R.id.settings\u容器,SettingsFragment())
.commit()
}
}
类设置片段:PreferenceFragmentCompat(){
重写FunonCreatePreferences(savedInstanceState:Bundle?,rootKey:String?){
addPreferencesFromResource(R.xml.preferences)
}
}



设置活动
中,如果没有
设置内容视图(…)
的话,所有内容是否都如您所期望的那样显示
setContentView(R.layout.settings\u活动)
@MFazio23所有内容都在显示,除了顶部的间隙,这是唯一错误的地方