ITeye博客

设置标题为:图片+文字效果

AndLi · 2011-10-08 11:19 · UI设计 · 移动开发 · Markdown

package com.lilin.title;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

public class Main extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

		setContentView(R.layout.main);

		this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
				R.layout.title);
	}
}

 R.layout.title

<?xml version="1.0" encoding="utf-8"?>
	<!-- 设置标题 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent" android:layout_height="wrap_content"
	android:orientation="horizontal" android:gravity="left|center">
	<ImageView android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:src="@drawable/test"
		android:layout_marginRight="5dp" android:layout_marginLeft="2dp" />
	<TextView android:id="@+id/text" android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:text="测试标题"
		android:textColor="#FFFFFF" />
</LinearLayout>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。