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..
Category : binding
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 ..
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" ..
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 ..
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 ..
It’s more of a theoretical question I guess. If I have a recycler view where I bind items that have 2 views(closed and full) the BindingUtil.inflate() is called insanly oft and it causes scrolling to be NOT fast. I’m looking for some ideas how can I optimise the calls of inflate() so that scrolling is ..
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..
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" ..
I have some lines of code written in onBindViewHolder in lang (java) .. I’m trying to write the exact code in kotlin in Binding Adapter , but i’m not able to write that EarthQuakeAdapter( JAVA) .. I tried but i was not able to write the same code to get magnitudeCircle , PrimaryLocation and LocationOffSet ..
I am using a bindingAdapter to set the background of a view no the base of a state. But the bindingAdapter only work when the view reinflates or the visibility change. Is there any way to invoke the binding without reinflating or changing the visibility? @BindingAdapter("bgClickable") fun bgClickable(layout: ConstraintLayout, state: String) { when (state) { ..
Recent Comments