Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.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_Preferencefragment - Fatal编程技术网

Android 从片段访问首选项类别布局视图

Android 从片段访问首选项类别布局视图,android,preferencefragment,Android,Preferencefragment,我有一个如下布局的首选类别 <android.support.v7.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> ------------- <android.support.v7.prefere

我有一个如下布局的首选类别

  <android.support.v7.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools">
        ------------- 
        <android.support.v7.preference.PreferenceCategory
                android:layout="@layout/test" />
        </android.support.v7.preference.PreferenceScreen>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="10dp"
    android:background="@color/green">

    <TextView
        android:id="@+id/version_textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/space_divider"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="8dp"
        android:fontFamily="sans-serif-light"
        android:text="Version: 7 / Build 7.1.001"
        android:textColor="@color/steel"
        android:textSize="11sp" />
</RelativeLayout>
但这两种方法似乎都不起作用

     @Override
        public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
            super.onViewCreated(view, savedInstanceState);
           view.findViewById(R.id.version_textview) 
        }