Graham
Graham

Reputation: 103

Coding the Android GUI programmatically

XML is great if you know beforehand what the layout is going to be. But some applications need to generate a dynamic GUI. For example, a Domain Specific Language (DSL) that places high-level custom GUI objects on the screen under the control of a script.

Is there an API reference - with examples - for programmatically coding a GUI in Java?

Upvotes: 2

Views: 2409

Answers (4)

Sadeshkumar Periyasamy
Sadeshkumar Periyasamy

Reputation: 4908

Every tag we are Declaring in layout XML has equivalent Class in Android SDK.

Every attribute you set in xml tag is the equivalent property of that class mostly with the same name.

So either you develop UI from XML or by code it is mostly the same except the XML layout design reduces a lot of effort.

The Android developer site has complete reference for XML attributes and Properties for Each widget.

Upvotes: 1

Samir Mangroliya
Samir Mangroliya

Reputation: 40416

No Deference,No API Reference Between XML Layout and Programmatically....

Just Like.... For Example, If You Use <TextView /> in your XML File Its TextView Class is Already in Package import android.widget.*; of Android Library.

And if you Use TextView as Programmatically Its Same .But Some RunTime and Custom GUI We use....

See this http://saigeethamn.blogspot.in/2010/12/creating-android-ui-programmatically.html

Upvotes: 2

Rajdeep Dua
Rajdeep Dua

Reputation: 11230

Look at the ApiDemos app shipped with SDK - it has some good examples for dynamic layouts.

Upvotes: 0

Related Questions