我正在使用材料设计,在材料设计中我可以将DeveloperNetwork.java返回到MainActivity.java。在下面的API 21设备中,我无法返回KitKat,JellyBean等。发生了什么?我无法搜索如何解决这个问题?这是public class DeveloperNetwork extends ActionBarActivity
{
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_developer_network);
toolbar = (Toolbar) findViewById(R.id.tb);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
onBackPressed();
return super.onOptionsItemSelected(item);
}
}
<activity
android:name=".Splash"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.example.javaclass.MainActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".DeveloperNetwork"
android:label="@string/title_activity_developer_network"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.javaclass.MainActivity" />
</activity>
manifests.java
import matplotlib.pyplot as pt
import numpy as np
fig = pt.figure()
ax = fig.add_subplot(111)
sample = 20
x=np.arange(sample)
y=10*np.sin(2*np.pi*x/20)
pt.plot(x,y)
pt.show()
答案 0 :(得分:0)
请尝试将android:parentActivityName
属性添加到.DeveloperNetwork活动代码中,如下所示。
<activity
android:name=".DeveloperNetwork"
android:label="@string/title_activity_developer_network"
android:screenOrientation="portrait"
android:parentActivityName="com.example.javaclass.MainActivity"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.javaclass.MainActivity" />
</activity>