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是自己写的一个基类。
更多相关文章
- android中怎么获得所有应用程序的快捷方式
- Android选项卡(TabWidget)应用
- SeekBar自定义
- Android中使用全屏
- Failed to fetch URL https://dl-ssl.google.com/android/reposi
- Android(安卓)Studio下“Error:Could not find com.android.tool
- Android隐藏标题栏,全屏显示
- Android:unable to start service Intent {act = com.android.ema
- Android(安卓)Notification使用