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>  
  • 相关阅读:
    NSString的几种常用方法
    ios页面间传递参数四种方式
    ios category类别的使用
    iOS: 枚举类型 enum,NS_ENUM,NS_OPTIONS
    IOS导航栏的使用方法
    报错:Expected one result (or null) to be returned by selectOne(), but found: 6
    Spring小知识
    spring动态代理
    登录和注册功能思路
    sql语句实例练习
  • 原文地址:https://www.cnblogs.com/tt_mc/p/1709015.html
Copyright © 2011-2022 走看看