java - Custom Title Bar in Android Preference Screen -


i have android preference screen in have tried add custom title bar xml. getting preference menu on title bar , unable set marginbottom. looking below.

enter image description here

my preference xml below

<?xml version="1.0" encoding="utf-8"?>  <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" >                            <preference              android:defaultvalue=""              android:key="about"              android:summary="know here"              android:title="about" />                    <checkboxpreference              android:key="background"              android:summary="show image status background"              android:title="background image" />                    <preference              android:defaultvalue=""              android:key="more"              android:summary="get more useful applications us"              android:title="more application" />                    <preference              android:defaultvalue=""              android:key="rate"              android:summary="give 5 star in play store , support us"              android:title="rate us" />          <preference              android:defaultvalue=""              android:key="shayari"              android:summary="download hindi shayari application"              android:title="shayari app" />                    <preference              android:defaultvalue=""              android:key="check"              android:summary="download new quotes via click here"              android:title="download new quotes" />                   <checkboxpreference              android:key="checkauto"              android:summary="tick dont download automatically"              android:title="dont download auto" />                    <preference              android:defaultvalue=""              android:key="share"              android:summary="you can share application friends"              android:title="share application" />              </preferencescreen>

my custom xml title below

<?xml version="1.0" encoding="utf-8"?>    <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"                   xmlns:ads="http://schemas.android.com/apk/res-auto"                   android:layout_height="fill_parent"                  android:layout_width="fill_parent">                        <linearlayout          android:id="@+id/titlebar"          android:layout_width="match_parent"          android:layout_height="50dp"          android:background="@drawable/title_bar"          android:layout_alignparenttop="true"          android:layout_marginbottom="20dp"          android:orientation="horizontal" >            <imageview              android:id="@+id/iconimg"              android:layout_width="40dp"              android:layout_height="40dp"              android:layout_gravity="center"              android:layout_margin="5dip"              android:background="@drawable/app_icon" />            <imageview              android:id="@+id/titleimg"              android:layout_width="160dp"              android:layout_height="45dp"              android:layout_gravity="center"              android:layout_margin="5dip"              android:background="@drawable/title" />            <relativelayout              android:id="@+id/pagerbtn"              android:layout_width="wrap_content"              android:layout_height="match_parent"              android:paddingright="2dip" >          </relativelayout>      </linearlayout>        <listview android:id="@android:id/list"           android:layout_width="fill_parent"           android:layout_height="fill_parent"/>        <com.google.android.gms.ads.adview          android:id="@+id/adview"          android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:layout_gravity="center"          ads:adsize="banner"          android:layout_alignparentbottom="true"          ads:adunitid="@string/admob_publisher_id"           />    </relativelayout>

and preference java code below

public void oncreate(bundle savedinstancestate) {  		requestwindowfeature(window.feature_no_title);  		this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);  		super.oncreate(savedinstancestate);          setcontentview(r.layout.config);          madview = (adview) findviewbyid(r.id.adview);  		madview.loadad(new adrequest.builder().build());    		db = new dao(this);  		db.open();  		  		  		  		pref = getapplicationcontext().getsharedpreferences("com.test.app_prefences.xml",0);  		  		tocheck = pref.getint("highscoresaved",0);

what missing or should make changes make header layout complete ? thanks

add android:layout_below="@+id/titlebar" listview in custom xml,

try code custom xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:ads="http://schemas.android.com/apk/res-auto"     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <linearlayout         android:id="@+id/titlebar"         android:layout_width="match_parent"         android:layout_height="50dp"         android:layout_alignparenttop="true"         android:layout_marginbottom="20dp"         android:background="@drawable/cal"         android:orientation="horizontal">          <imageview             android:id="@+id/iconimg"             android:layout_width="40dp"             android:layout_height="40dp"             android:layout_gravity="center"             android:layout_margin="5dip"             android:background="@drawable/approval" />          <imageview             android:id="@+id/titleimg"             android:layout_width="160dp"             android:layout_height="45dp"             android:layout_gravity="center"             android:layout_margin="5dip"             android:background="@drawable/back_dark" />          <relativelayout             android:id="@+id/pagerbtn"             android:layout_width="wrap_content"             android:layout_height="match_parent"             android:paddingright="2dip">          </relativelayout>     </linearlayout>      <listview         android:id="@android:id/list"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_below="@+id/titlebar" />      <com.google.android.gms.ads.adview         android:id="@+id/adview"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_gravity="center"         ads:adsize="banner"         ads:adunitid="@string/admob_publisher_id" />  </relativelayout> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -