zoukankan      html  css  js  c++  java
  • 自定义Activity的标题栏

    MyActivity.java 
    Java代码 复制代码
    1. requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);     
    2. setContentView(R.layout.main);            
    3. getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);     
    4. TextView titleTV = (TextView)findViewById(R.id.title);     
    5. titleTV.setText(R.string.app_name);   

    title.xml
    Java代码 复制代码
    1. <?xml version="1.0" encoding="UTF-8"?>   
    2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"        
    3. android:orientation="horizontal"       
    4. android:layout_width="fill_parent"        
    5. android:layout_height="fill_parent"     >       
    6. <TextView            
    7. android:id="@+id/title"            
    8. android:layout_width="wrap_content"            
    9. android:layout_height="wrap_content"            
    10. android:layout_weight="1"            
    11. android:layout_gravity="center"            
    12. android:gravity="center" />   
    13. </LinearLayout>  
  • 相关阅读:
    webpack中Entry与Output的基础配置
    使用plugins让打包更便捷
    使用loader打包静态文件-样式2
    nginx 静态文件支持跨域访问权限
    Python代码规范
    HUD2087
    codevs1404字符串匹配
    codevs3013单词背诵
    bzoj1584[Usaco2009 Mar]Cleaning Up 打扫卫生
    codevs1690开关灯
  • 原文地址:https://www.cnblogs.com/tt_mc/p/1709015.html
Copyright © 2011-2022 走看看