Android Question XmlLayoutBuilder - can a CustomView be set in a xml layout file?

leitor79

Active Member
Licensed User
Longtime User
Hi!

Can I define a layout for a customview in the xml file? How it should be done? Like this?

B4X:
<CustomView
  android:layout_width="match_parent" android:layout_height="wrap_content"
  android:layout_weight="0" />

Thank you!
 

MarcoRome

Expert
Licensed User
Longtime User
Hi!

Can I define a layout for a customview in the xml file? How it should be done? Like this?

B4X:
<CustomView
  android:layout_width="match_parent" android:layout_height="wrap_content"
  android:layout_weight="0" />

Thank you!
Look THIS
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Hi MarcoRome, thank you very much for your answer!

I'm not sure I understood the link you've referred.

I have a XML Layout file that sets styles for specific type of views. Like this:

B4X:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ImageView
        android:id="@+id/test_backimage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:src="@drawable/my_dark_bg" >
    </ImageView>

So, that layout affects an ImageView named test_backimage. The code in the post you've referred sets whole theme items?


Thank you very much!
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Hi Erel, thank for your answer.

I mean this:
2017-04-15 00_03_35.png


The customview I want to use is set as a CustomListView.

Thank you very much!
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Hi Erel, thank you for the answer, but I think I don't get it or I've explain myself wrong.

The thing I'd like to know is if I could be able to work with the XML Layout using a CustomListView or an AutoSizeTextLabel (in the example in the third post, instead of the ImageView) and how it could be done.

Thank you very much!
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Hi Erel, thank you for your answer.

So that, I understand I can't use an AutoTextSizeLabel in a widget; I should use a standard label and calculate and set the size manually; am I right?

Thank you!
 
Upvote 0
Top