1

In WPF (Microsoft land I know) you can define a control in XAML (xml-ish thing) along with the controls behaviour in codebehind (C#).

So in an XML file I want to be able to say something like:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res/com.example.mytestapp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

control:name="MyCustomControl" >

<Button />
<stuff>(...)</stuff>
</LinearLayout>

And also have a java source file called MyCustomControl which controls the behaviour of the control defined in the XML file.

Is there an equivalent for android with Java/XML? All I see are things involving custom attributes where you have to write out the entire control in Java still :-/

2 Answers 2

2

Of course, Android is all about JAVA/XML. In fact, normally you design your UI(widgets/controls) in xml files(you can do it also programatically), and then you implement their behavior commonly on classes that extends Activity, an Android built in class. Check this out

Sign up to request clarification or add additional context in comments.

1 Comment

That simply sets attributes, what I'd like to do is define an entire control in XML and java not just some attributes...
1

You can integrate your android interfaces with XAML and Java, as you use to in WPF. Look at this link for more info about how to do it: http://dotnetslackers.com/articles/net/Android-for-NET-Developers-Building-the-User-Interface.aspx

1 Comment

That simply sets attributes, what I'd like to do is define an entire control in XML and java not just some attributes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.