• android自定义带图片的title


     1、title布局文件如下:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
            <ImageView
                android:layout_width="18px"
                android:layout_height="18px"
                android:src="@drawable/logo"
            ></ImageView>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000"
                android:textSize="14px"
                android:text="@string/app_name"
            ></TextView>
    </LinearLayout>

    这是一个水平的LinearLayout布局,里面包含一个ImageView(显示图片)和一个TextView(显示文本).

    2、LonginActivity实现类如下:女装品牌排行榜

    public class LoginActivity extends BaseActivity{

         private  static String TAG="LoginActivity";
         @Override
         public void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
               requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
               setContentView(R.layout.login);   
               getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,     
                          R.layout.title);  
         }
         
    }风之境地 java-javascript

    BaseActivity是自己写的一个基类。

  • 相关阅读:
    2020/10/10周总结
    2020/10/02周总结
    2020/9/28周总结
    第十二周总结
    第十一周总结
    人月神话阅读笔记03
    人月神话阅读笔记02
    人月神话阅读笔记01
    冲刺一8
    冲刺一7
  • 原文地址:https://www.cnblogs.com/sky7034/p/2041865.html
Copyright © 2020-2023  润新知