第二阶段--最终作业

设置圆角的有点击事件的资源的background

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape> 
            //圆角
            <corners android:radius="8dp">corners>
            //填充
            <solid android:color="#aae7bfa0">solid>
            //外边框
            <stroke android:width="1dp" android:color="#f56b09">stroke>
        shape>
    item>

    <item>
        <shape>
            <corners android:radius="8dp">corners>
            <solid android:color="#AA444444">solid>
            <stroke android:width="1dp" android:color="#b6b1b1">stroke>
        shape>
    item>
selector>

Toolbar的使用
xml

.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/id_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    app:navigationIcon="@drawable/back"
    app:titleTextColor="#ffffff" />

class

protected void setUpToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
        //必要
        setSupportActionBar(toolbar);

        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

    }

你可能感兴趣的