Android中自定义标题栏(二)
来源:互联网 发布:app软件破解器 编辑:程序博客网 时间:2024/05/17 22:14
activity代码
package com.android.demo;import android.app.Activity;import android.os.Bundle;import android.view.Window;import android.widget.ImageView;import android.widget.TextView;public class MytestActivity extends Activity {private TextView myText;private ImageView myImage; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.titlebar); myText = (TextView)findViewById(R.id.myText); myText.setText("自定义标题栏"); myImage = (ImageView)findViewById(R.id.myImage); myImage.setBackgroundResource(R.drawable.ic_launcher); }}titlebar.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" ><ImageView android:id="@+id/myImage" android:layout_width="wrap_content" android:layout_height="wrap_content" /><TextView android:id="@+id/myText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" /></LinearLayout>
效果图:
- Android中自定义标题栏(二)
- Android中自定义标题栏(一)
- Android中自定义标题栏(三)
- android中如何自定义标题栏
- Android 标题栏(二)
- Android - 自定义标题栏(TitleBar)
- Android:自定义标题栏(titlebar)
- Android--自定义标题栏(TopBar)
- Android项目中自定义顶部标题栏
- Android项目中自定义顶部标题栏
- Android项目中自定义顶部标题栏
- Android项目中自定义顶部标题栏
- Android项目中自定义顶部标题栏
- Android 自定义标题栏(title栏)
- Android自定义title bar(标题栏)
- Android 自定义标题栏(title栏)
- Android 自定义标题栏(title栏)
- Android 自定义标题栏(title栏)
- Java Annotation手册
- asp.net下使用CKEditor和CKFinder
- 硬盘还是很贵
- Bug碎碎念(1) If u r a man,U need face.
- iPhone开发-输出口和操作
- Android中自定义标题栏(二)
- 在LINUX中CppUnit应用指南
- java.lang.InstantiationException: DWR can't find a spring config. See the logs for solutions
- hdu 题目分类(详细不详细!)
- 策略模式(Strategy Pattern)
- Linux安装eclipse
- 点击 我要分享后出现下拉菜单
- 反射概述 和Type类
- Unix网络编程代码 第11章 名字与地址转换