TIMEOUT

I wonder what happens if I write one code in XML and another in Java

I have this code in my program:

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

In my manifest, I have this:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black.NoTitleBar">
</activity>

I think this is true for all XML editing, but I want to make sure that if I have a java code similar to XML and there are some differences, will it use my XML format or Java code?

resolvent:

It always uses Java code because it runs second. However, if you are expanding from XML and you will expand after doing some Java work (for layout), XML will overwrite the code you write

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>