FileDocCategorySizeDatePackage
CustomTitle.javaAPI DocAndroid 1.5 API2988Wed May 06 22:41:08 BST 2009com.example.android.apis.app

CustomTitle

public class CustomTitle extends android.app.Activity
Example of how to use a custom title {@link android.view.Window#FEATURE_CUSTOM_TITLE}.

CustomTitle

This demonstrates how a custom title can be used.

Demo

App/Title/Custom Title

Source files

src/com.example.android.apis/app/CustomTitle.java The Custom Title implementation
/res/any/layout/custom_title.xml Defines contents of the screen

Fields Summary
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)
Initialization of the Activity after it is first created. Must at least call {@link android.app.Activity#setContentView(int)} to describe what is to be displayed in the screen.

        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.custom_title);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1);
        
        final TextView leftText = (TextView) findViewById(R.id.left_text);
        final TextView rightText = (TextView) findViewById(R.id.right_text);
        final EditText leftTextEdit = (EditText) findViewById(R.id.left_text_edit);
        final EditText rightTextEdit = (EditText) findViewById(R.id.right_text_edit);
        Button leftButton = (Button) findViewById(R.id.left_text_button);
        Button rightButton = (Button) findViewById(R.id.right_text_button);
        
        leftButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                leftText.setText(leftTextEdit.getText());
            }
        });
        rightButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                rightText.setText(rightTextEdit.getText());
            }
        });