Am Freitag, den 17.02.2012, 10:23 +0100 schrieb Felipe Monteiro de
Carvalho:
> On Fri, Feb 17, 2012 at 9:11 AM, <[email protected]> wrote:
> > Android uses XML files to specify the layout. This is the recommended way by
> > Google. You can build the GUI in code as well, but then you're pretty much
> > in uncharted territory.
>
> It is pretty trivial to build the UI without XML. I never used the XML
> part while programming for Android. For example (in pseudo-code):
>
> procedure TMyActivity.OnCreate;
> var
> layout: TAbsoluteLayout;
> params: TAbsoluteLayout_LayoutParams;
> tv: TTextView;
> et: TTextView;
> btn: TButton;
> ClickCount: Integer = 0;
> begin
> // Prepares the UI of the program
> layout := TAbsoluteLayout.Create;
>
> tv := TTextView.Create;
[...]
> params.Free;
>
> btn := TButton.Create;
> btn.setText('Go!');
> btn.setOnClickListener(@buttonClickCallback);
> params := TAbsoluteLayout_LayoutParams.Create(320, 50, 0, 60);
> layout.addView(btn, params);
> params.Free;
>
> Activity.setContentView(layout);
> end;
Very similar to what Java IDEs generate for form building code. ;)
Beautiful, very easy to handle and reagularly looking code. Besides
having to self draw any component that's nice. But by code reuse the
drawing issue will be solved very soon once started, I assume.
Thank you!
Marc
--
Marc Santhoff <[email protected]>
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus