Android Question @drawableRight

alon

Active Member
Licensed User
Longtime User
Hi All,

I have a checkbox
and the checkbox shows text at right side and checkbox at left.
I need to show checkbox at right side with text at left.

I know that in ecplise i should write in the xml something like that:

android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

Thanks In Advance
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Add a reference to XmlLayoutBuilder.
2. Add this code to the manifest editor:
B4X:
CreateResource(layout, checkbox,
  <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/chk1"

  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

  android:tag="chk1" />
)
3. Add one or more panels with the designer as the checkboxes parents.
4.
B4X:
Sub Globals
   Private chk1 As CheckBox
   Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
      Activity.LoadLayout("1")
   Dim xml As XmlLayoutBuilder
   xml.LoadXmlLayout(Panel1, "checkbox")
   chk1 = xml.GetView("chk1")
   chk1.Text = "sdfsdfklj"
End Sub

Sub chk1_CheckedChange(Checked As Boolean)
   Log(Checked)
End Sub
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Hi Erel,

tahnks for your reply,
i just do not understand what does it mean to Add a reference to XmlLayoutBuilder.

10X
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Check it in the libraries tab:
SS-2016-10-26_10.50.06.png
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Thanks, i dont have this lib but i searched the form and find it,
so i will try it.

thanks again.
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
1. Add a reference to XmlLayoutBuilder.
2. Add this code to the manifest editor:
B4X:
CreateResource(layout, checkbox,
  <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/chk1"

  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

  android:tag="chk1" />
)
3. Add one or more panels with the designer as the checkboxes parents.
4.
B4X:
Sub Globals
   Private chk1 As CheckBox
   Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
      Activity.LoadLayout("1")
   Dim xml As XmlLayoutBuilder
   xml.LoadXmlLayout(Panel1, "checkbox")
   chk1 = xml.GetView("chk1")
   chk1.Text = "sdfsdfklj"
End Sub

Sub chk1_CheckedChange(Checked As Boolean)
   Log(Checked)
End Sub

Thanks Works Greate...
 
Upvote 0
Top