e.g. item1, item2, item3 and you just want to show item1 and item3
depending on a given bool state?
So, to be clear: my purpose is to show all items anyway, but to leave
some of them "enabled" (i.e. as they usually are), and some of them
"disabled".
By "enabled" I mean that the single item (and all its contained Views)
can receive clicks and has its "default" look.
By "disabled" I mean that it cannot receive clicks and it shows some
kind of "disabled" look, e.g. greyed, whatever.
So I my understanding, reading your replies, is that I should try to
set following attribute:
binding:enabled="Enabled"
at the item ViewGroup level. Hence something like:
my_item_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:binding="http://www.gueei.com/android-binding/"
binding:enabled="itemEnabled"
style="@style/list_item_container_layout">
<ImageView
android:id="@+id/listItemImageView"
binding:source="image"
style="@style/list_item_image" />
<TextView
android:id="@+id/listItemTextView"
binding:text="title"
style="@style/list_item_text" />
<CheckBox
android:id="@+id/listItemCheckBox"
binding:checked="checked"
style="@style/list_item_check" />
</RelativeLayout>
I did not get what you said regarding choiceMode. Anyway I'll try with
this and let you know the outcomes.
Thanks. Cheers
You're welcome.
Actually, that would be quite a sleek solution!
Nella citazione in data mercoledì 21 dicembre 2011 01:53:32, Andy Tsui ha scritto:
Thanks for your effort. I think I omit a truth that the child layout is handled by ListView and no item level control is possible. I may update that part soon, here's my proposed method:
(in markup)
<ListView
binding:adapter="{dataSource=..., itemTemplate=..., enabled='Enabled'}"
* enabled will look at the item level property for Enabling or not. this is optional, if nothing specified, that means allItemsEnabled.
so, this could prevent the need for IEnabled interface, and could be a bit more generic.
Andy
On Wed, Dec 21, 2011 at 6:46 AM, Giuseppe <piscopo....@gmail.com <mailto:piscopo.giuseppe@gmail.com>> wrote:*** *__*MyItemObservable.java*
Missing bit from previous one:
public class MyItemObservable implements IEnabled
{
[...]
@Override
public boolean isEnabled()
{
return /* calculate your enabled state */;
}
}