Adding custom layout to PreferenceFragment

后端 未结 2 680
有刺的猬
有刺的猬 2021-01-05 05:47

I have a preference fragment with a preference screen hierarchy. I would like to add a custom layout to define an \"about the author\" section, adding imageview to an elemen

2条回答
  •  悲&欢浪女
    2021-01-05 05:58

    In your preference xml file (res/xml/prefs.xml), add a Preference with a custom layout:

    
    

    Example of layout/custom_preference.xml with an ImageView and a TextView with a link that will be opened in the browser:

    
    
        
        
    
    

    It's the last preference in the screenshot:

提交回复
热议问题