Android 为什么删除字符串后Hello World仍显示?
尝试我的第一个Android应用程序时,删除了“Hello World”字符串,但在我的设备上运行时仍能看到它。为什么? 另一个问题是,如何将其设置为另一个值?例如,我想在Android 为什么删除字符串后Hello World仍显示?,android,Android,尝试我的第一个Android应用程序时,删除了“Hello World”字符串,但在我的设备上运行时仍能看到它。为什么? 另一个问题是,如何将其设置为另一个值?例如,我想在OnCreate()的末尾将其设置为“Application created” 这是我的OnCreate()函数,没有任何更改: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCon
OnCreate()的末尾将其设置为“Application created”
这是我的OnCreate()
函数,没有任何更改:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
这是我的activity\u main.xml
,只是简单地删除了图形布局中的“Hello World”字符串:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.dqtools.egg.MainActivity"
tools:ignore="MergeRootFrame" >
</FrameLayout>
转到res>值>字符串
有零钱
<string name="hello_world">Hello World</string>
你好,世界
到
你想要什么都行
您正在从activity\u main.xml
中删除Hello world文本视图,从fragment\u main.xml
中删除它您是否清理了您的项目并再次运行了它?请尝试在您的仿真程序中再次安装修改后的应用程序您正在从activity\u main.xml
中删除Hello worldTextView
。相反,请从fragment\u main.xml
@Lal中删除它,谢谢。这就解决了我的问题。我如何接受你的回答?
<string name="hello_world">Anything u want</string>