0

Possible Duplicate:
Set custom title bar in PreferenceAcivity

Is it possible to add a custom title bar for a preferancActivity ?

Community
  • 1
  • 1
Kamalone
  • 4,045
  • 5
  • 40
  • 64
  • I tried i am able show the title bar but the views inside the title bar are not visible in that. Where i can show the same title bar in an activity – Kamalone Aug 06 '12 at 05:18

1 Answers1

0
public class Preferences extends PreferenceActivity {  
protected TextView title;
   @Override
   protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);        
    setContentView(R.layout.main_tab);
    title = (TextView) findViewById(R.id.titleTvLeft);

    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);

    this.title.setText("Value");

  }
}

///////In title_bar.xml///////

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout01"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    fill_parent="" >

    <TextView
        android:id="@+id/titleTvLeft"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="3dp"
        android:textColor="#FFFFFF"
        android:textStyle="bold" >
    </TextView>



</RelativeLayout>
Furqi
  • 2,403
  • 1
  • 26
  • 32