http://wenku.baidu.com/link?url=D93O4XxbjID1hxTF5Y7dhV14mx-aadsaHSSHCSyqzwvr7ug0Rycd-TFy9QVACn91Tzw_rk2LwIb5LDa22DWw4oJbqczrLxMtDTwmq4ew2Gi
Android中标题栏添加按钮
现在很多的Android程序或陆都在标题栏上都显示了一些按钮和标题,如下图:
下面通过实例来段团州看一下如何实现。
1、在layout下创建一个titlebtn.xml文件,内容如下: [html] view plaincopyprint?
1. <?xml version="1.0" encoding="utf-8"?>
2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr
oid"
3. android:orientation="horizontal" 4. android:layout_width="fill_parent"握蔽 5. android:layout_height="fill_parent"> 6.
7. <ImageButton
8. android:id="@+id/imageButton1" 9. android:layout_width="wrap_content" 10. android:layout_height="wrap_content" 11. android:background="#00000000" 12. android:layout_centerVertical="true" 13. android:layout_alignParentLeft="true" 14. android:src="@drawable/prv" /> 15.
16. <TextView
17. android:layout_width="wrap_content"
那个应该不是自带的标题,是自定义的标题。汪腊androidmanifest.xml里困兆滑看一下你引用的theme,在style.xml的你引用的theme标签里添加<item name="android:windowNoTitle">true</item>这一句猜芦去掉自带的标题。然后自定义一个标题就行了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)