跳转空白界面
EmptyActivity.java
package com.example.smartcity.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.smartcity.R;
import com.example.smartcity.utils.KeyUtils;
import static com.example.smartcity.utils.KeyUtils.VALUES;
public class EmptyActivity extends AppCompatActivity {
private ImageView mBack;
private TextView mContent;
private TextView mTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_empty);
initView();
String values = getIntent().getStringExtra(VALUES);//取值
mContent.setText(values);
mTitle.setText(values);
}
public void initView(){
mBack = (ImageView) findViewById(R.id.back);
mContent = (TextView) findViewById(R.id.content);
mTitle = (TextView) findViewById(R.id.title);
mBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
activity_empty.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.EmptyActivity"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_back_s"
android:layout_gravity="center"
android:layout_marginLeft="20dp"/>
<TextView
android:id="@+id/title"
android:layout_width="280dp"
android:layout_height="match_parent"
android:text="title"
android:textSize="30dp"
android:gravity="center"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#c7c7c7"/>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Content"
android:gravity="center"
android:textSize="30dp"/>
</LinearLayout>