У меня есть Android Preference Screen
, в котором я попытался добавить пользовательский Title Bar
с дополнительным xml. Но я получаю Preference Menu
в строке заголовка и не могу установить marginBottom
. Это выглядит как внизу.Пользовательская панель заголовка на экране предпочтений Android
Мой Preference XML, как ниже
<?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 About Us From Here"
android:title="About" />
<CheckBoxPreference
android:key="background"
android:summary="Show Image with Status as Background"
android:title="Background Image" />
<Preference
android:defaultValue=""
android:key="more"
android:summary="Get More Useful Applications By Us"
android:title="More Application" />
<Preference
android:defaultValue=""
android:key="rate"
android:summary="Give Us Five Star in Play Store and 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 to dont download automatically"
android:title="Dont download Auto" />
<Preference
android:defaultValue=""
android:key="share"
android:summary="You can Share This Application to Your Friends"
android:title="Share Application" />
</PreferenceScreen>
Мой обычай 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_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>
и, наконец, мое предпочтение код Java как ниже
public void onCreate(Bundle savedInstanceState) {
\t \t requestWindowFeature(Window.FEATURE_NO_TITLE);
\t \t this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
\t \t super.onCreate(savedInstanceState);
setContentView(R.layout.config);
mAdView = (AdView) findViewById(R.id.adView);
\t \t mAdView.loadAd(new AdRequest.Builder().build());
\t \t db = new DAO(this);
\t \t db.open();
\t \t
\t \t
\t \t
\t \t pref = getApplicationContext().getSharedPreferences("com.test.app_prefences.xml",0);
\t \t
\t \t tocheck = pref.getInt("highscoresaved",0);
Что мне не хватает или где я должен сделать изменения для разметки заголовка макияжем в комплекте? Благодаря
Спасибо! Это спасло мой день :) –