에뮬레이터에서 앱을 실행하면 앱 이름이 표시되지 않는 탐색 표시 줄이 나타납니다. 무슨 일이 일어나는지 알아?Android Studio 탐색 표시 줄에 앱 이름이 표시되지 않습니까?
public class MainActivity extends Activity implements OnClickListener {
EditText first_name;
EditText last_name;
Button button_submit;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
first_name = (EditText) findViewById(R.id.first_name);
last_name = (EditText) findViewById(R.id.last_name);
button_submit = (Button) findViewById(R.id.button_submit);
button_submit.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = new Intent(this, ViewActivity.class);
intent.putExtra("first_name", first_name.getText().toString());
intent.putExtra("last_name", last_name.getText().toString());
startActivity(intent);
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yuqk.intent_usage">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ViewActivity"></activity>
</application>
Style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
,
참조 용 스크린 샷을 참조하십시오 .. 감사합니다! 당신이 toolbar
이 XML에 포함되어있는 경우
xml 및 java 코드에'toolbar '를 추가 했습니까 ??? – Ironman