Category : binding

When i am trying to bind my layout i am receiving java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/my_layout_0 this.full_blown_floating_view = layoutInflater.inflate(R.layout.dailer_layout,null,false); DailerLayoutBinding dailerLayoutBinding = (DailerLayoutBinding)DataBindingUtil.bind(this.full_blown_floating_view); Source: Android..

Read more

I have two int variables (myRank, totalRanks) to display current rank in my app like: Rank: 2/10 Because my string template is complex (still %d/%d but in HTML format with font size, font color), instead of <androidx.appcompat.widget.AppCompatTextView android:text="@{@string/text_current_rank(myRank, totalRanks)}" /> I have to create a custom BindingAdapter: @BindingAdapter("android:htmlText") fun setHtmlText(view: TextView, text: String) { view.text ..

Read more

I have this code. So I want to set height in my relativeLayout by height in scrollView. Can I set height by id of scrollView? It’s need, because I have many fragments, but one of them should take height of scrollView (when virtual keyboard is open). … <ScrollView android:id="@+id/scrollViewer" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <FrameLayout android:id="@+id/frameViewer" android:layout_width="wrap_content" ..

Read more

I’m using a custom view, com.deadballapp.deadball.ui.pitch.PitchLiveView, but my binding class is unable to access this view. The binding class is able to access cl_pitch_live PitchLiveView isn’t inflated, it’s a class that extends View which I’m using to draw to the Canvas so any solution to binding to a custom view I’ve seen here, here and ..

Read more

today I’m starting my new project with view binding. But, I have a problem which I don’t know how to call another layout id with data binding. I want to call id ‘txt_chapter_number’ in chapter_item.xml Is there anyone who can help me? ChapterActivity.kt import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import com.tutorial.kotlinfirebasecomicreader.databinding.ActivityChapterBinding ..

Read more

I have implemented data binding in xml and I want to set layoutDirection to my linearlayout, but it causes error like below. Here is my code <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorSecondaryVariant" android:orientation="horizontal" android:layoutDirection=’@{type.equalsIgnoreCase("sell") ? "rtl" : "ltr" }’ android:baselineAligned="false"></Linearlayout> This is the error Source: Android..

Read more

I want to pass a variable of color included layout , currently. I’m trying to pass color form viewmodel object.color string , but it is not working. this is my xml layout head <layout 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"> <data> <import type="android.graphics.Color"/> <variable name="mainViewModel" type="uz.appme.ussd.MainViewModel" /> </data> this textView text is working <androidx.appcompat.widget.AppCompatTextView android:id="@+id/textViewProviderName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" ..

Read more