Android Question Xml layout builder Event not working

mshafiee110

Active Member
Licensed User
Longtime User
I'm using a xml layout in my own app ...
When I add this line's to my layout ,Event's not working

B4X:
    xmlns:app="http://schemas.android.com/apk/res-auto"
'or
    xmlns:tools="http://schemas.android.com/tools"


this working nice
B4X:
   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:paddingLeft="16dp"
   android:paddingRight="16dp"
   android:orientation="vertical" >
   
   
   <Button 
   android:id="@+id/Button1"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="myButton"
   android:tag="Button1"  >
   </LinearLayout>



in this case not working event's
B4X:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:paddingLeft="16dp"
   android:paddingRight="16dp"
   android:orientation="vertical" >
   
<ImageButton
    android:layout_width="@dimen/spacing_mxlarge"
    android:layout_height="@dimen/spacing_mxlarge"
    android:layout_marginTop="16dp"
    android:background="@android:color/transparent"
    android:tint="@color/grey_60"
    app:srcCompat="@drawable/exit_to_app" />
   
   <Button 
   android:id="@+id/Button1"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="myButton"
   android:tag="Button1" >
   </LinearLayout>
 

mshafiee110

Active Member
Licensed User
Longtime User
Avoid using XML layouts if you can. It is not recommended when developing with B4A.
You can easily create a button with an image.

I guess that the event is raised by ImageButton so it is not intercepted.
tnx a lot
I'm using a lot of pre made xml layout , and for some reason I can not change it.
I could do it using the reflection library, but I use it for a lot of views and tag is easier to use.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…