Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8726619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:17:11+00:00 2026-06-13T08:17:11+00:00

I know Java programming well. I am working on an Android project and have

  • 0

I know Java programming well. I am working on an Android project and have learned about how to create an application for android. However, I have a point that I do not understand about interfaces of android. When we are working on Java we have used in code screen panels and some imports like Swing, AWT, SWT, but now we are creating interfaces on XML files and I do not understand how do XML files create an interface. I want to know its logic. Could you please enlighten me about XML files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:17:12+00:00Added an answer on June 13, 2026 at 8:17 am

    Think of XML sort of like HTML – you are basically using markup to define UI components and giving them basic style attributes like position, size, colors, etc, but not really any behavior properties. XML tags, like HTML, have names, and attributes that define properties. They can be nested as well, in many cases. When a tag has other tags nested in it, we call those children. Tags with children have the opening tag () and a closing tag (). Children are defined in between. Tags without children may omit the closing tag by placing a / (slash) in front of the enclosing >

    <LinearLayout>
        <Button
           android:layout_width="100dp"
           android:layout_height="25dp"
           android:id="@+id/my_button"
           android:text="CLICK HERE" />
    </LinearLayout>
    

    The attributes have the android: label on them so that the xml parser can properly recognize they are properties defined by android, to put it simply. The build tools included in the eclipse ADT (or in the sdk tools if you are not using eclipse) generate java objects behind the scenes with the corresponding properties appropriately set, so that you don’t have to do that work. It also generates an R.java file, which contains pointers to the java objects it generates for your layout elements, so that you can easily reference them in java code:

    Button myButton = (Button) findViewById(R.id.my_button);
    myButton.setOnClickListener(...);
    

    If you want, you CAN do your layout/UI development entirely with java code, but it becomes much more verbose and tedious, as you will have to explicitly set many values which are implied/omitted in the corresponding XML code. XML saves a lot of time and the visual editors make it a lot easier/faster to get the look how you want it.

    With XML, you can also define things like Strings which you want to easily internationalize, and simple drawables which, if done correctly, will easily scale up n down screen sizes and resolution, and simple animations. Using the “qualified path names” on your resource directories, you can provide alternative versions of any value/resource defined in XML (such as layouts, drawables, or strings) which will be appopriately swapped out at run-time based on the users device & settings.

    For instance, you can define a layout, say main.xml, in res/layout-land for landscape, and an alternate version in res/layout-port for for portrait. Then the app will load the layout which corresponds to the users orientation automatically. Similarly, you can define a string, say button_label, in res/values-en/strings.xml which has a value of “Yes”, and define a string with the same name, button_label, in res/values-es/strings.xml with a value of “Si”. If the users locale is set to english, ‘Yes’ will be used. If their local is Spanish, “Si” will be used.

    http://developer.android.com/training/basics/firstapp/building-ui.html

    http://developer.android.com/guide/topics/ui/declaring-layout.html

    http://developer.android.com/guide/topics/resources/overview.html

    http://developer.android.com/guide/topics/graphics/view-animation.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a background of programming in Java and C++, so I know all
I know java well, and have some experience in EclipseLink, Hibernate, JSF, Grails and
I am very new to Java as well as Android programming. I was attempting
Edit: I should have probably mentioned that I am extremely new to Java programming.
I'm an intermediate programmer. I know C very well, Java somewhat well, and have
I have someone I need to train in Java. That person is well versed
Before I start know this: I am extremely new to Java and programming. How
Why in java (I dont know any other programming languages) can an identifier not
I know Java's generics are somewhat inferior to .Net's. I have a generic class
I'm new to Scala and don't know Java. I want to create a jar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.