首页 > 解决方案 > 状态栏上的Android默认返回操作

问题描述

我正在做一个项目,在屏幕上我想要一个标题而不是默认情况下在android中的后退按钮我尝试了以下但无法解决它。

static navigationOptions = {
  title: 'Please sign in',
  };

&&

static navigationOptions = {
headerTitle: 'Your Bmi details',
headerRight: (
 <Button
   onPress={() => alert('This is a button!')}
   title="Info"
   color="#fff"
 />
),
}}

我想要标题栏上的标题和按钮。我已附上屏幕截图,请检查并帮助我解决问题。

在此处输入图像描述

有人可以帮我吗?

谢谢。

标签: androidperformancereact-native

解决方案


在您声明活动的 AndroidManifest.xml 文件中,例如:

 <activity android:name=".SecondAvtivity"
        android:parentActivityName=".MainActivity">

只需删除父活动名称

 <activity android:name=".SecondAvtivity">

它应该解决问题


推荐阅读