title: How do access custom layout from PreferenceFragmentCompat?
body: <p>I want to access views from a custom layout that was set to a <code>preference</code></p>
  
  <p><strong>settings_screen.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen
          xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;Preference
              android:key="storage"
              android:layout="@layout/layout_storage" /&gt;
  
      ...
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p><strong>SettingsFragment.kt</strong></p>
  
  <pre><code>class SettingsFragment: PreferenceFragmentCompat() {
      override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
  
      }
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
  
          addPreferencesFromResource(R.xml.settings_screen)
      }
  }
  </code></pre>
  
  <p>There was a question on stackoverflow similar to this, but in that answer, he is accessing the view from the main layout file not from <code>preference</code></p>
  
  <p><a href="https://stackoverflow.com/questions/35966844/preferencefragmentcompat-custom-layout?answertab=active#tab-top">PreferenceFragmentCompat custom layout</a></p>
  
  <p>and also I found this article, he uses <code>onBindView</code> method to access the custom view.</p>
  
  <p><a href="https://code.luasoftware.com/tutorials/android/override-layout-of-android-preference/" rel="nofollow noreferrer">https://code.luasoftware.com/tutorials/android/override-layout-of-android-preference/</a></p>
  
  <p>but there is no method call <code>onBindView</code> in <code>PreferenceFragmentCompat</code></p>
  
  <p><strong>UPDATED</strong></p>
  
  <p><strong>layout_storage.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
          android:padding="20dp"
          android:orientation="vertical"
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
      &lt;LinearLayout
              android:paddingBottom="5dp"
              android:orientation="horizontal"
              android:layout_width="match_parent" android:layout_height="wrap_content"&gt;
  
          &lt;TextView
                  android:textColor="@color/colorGray"
                  android:paddingTop="5dp"
                  android:layout_weight="1"
                  android:text="USED"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"/&gt;
  
          &lt;TextView
                  android:textColor="@color/colorGray"
                  android:text="FREE"
                  android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt;
      &lt;/LinearLayout&gt;
  
  
      &lt;ProgressBar
              android:progress="30"
              android:scaleY="5"
              style="?android:attr/progressBarStyleHorizontal"
              android:layout_width="match_parent"
              android:layout_height="20dp"
              android:id="@+id/progressBar"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Now I want to get the <code>progressBar</code></p>