Android Data Binding Library Default value in Data Binding

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

The Preview pane displays default values for data binding expressions if provided.

For example :

android:layout_height="@{@dimen/main_layout_height, default=wrap_content}"

It will take wrap_content while designing and will act as a wrap_content in preview pane.

Another example is

android:text="@{user.name, default=`Preview Text`}"

It will display Preview Text in preview pane but when you run it in device/emulator actual text binded to it will be displayed



Got any Android Question?