1

For my preference screen xml, I want to inflate a custom layout. Here is my preference screen xml:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"

-----
-----

<Preference
        android:key="preview"
        android:layout="@layout/redesign_preview_pref_layout"
        android:persistent="false"
        android:title="@string/setting_preview" />

Everything is working for this screen except "preview" preference. It is not inflating the "redesign_preview_pref_layout" layout.

Here is "redesign_preview_pref_layout" layout code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="15dp" >

    <TextView
        android:id="@+id/previewScreen"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="@color/half_transpernt_button_color"
        android:gravity="center"
        android:text="@string/pref_preview_button"
        android:textColor="@android:color/white"
        android:textSize="16sp" />

</LinearLayout>

Can someone help me by telling what am I doing wrong? Thanks for any help

Sushil
  • 8,250
  • 3
  • 39
  • 71
  • Are you getting any error/exception (your title suggests so)? Could you paste the error log as well? See if [this closely related question](http://stackoverflow.com/questions/16108609/android-creating-custom-preference) does not provide some useful hints – ishmaelMakitla Jun 20 '16 at 22:25
  • @ishmaelMakitla.. thanks for your comment. I do not get any error. In the place of my desired layout, it just shows a text. – Sushil Jun 21 '16 at 11:47

0 Answers0