![](/img/trans.png)
[英]How to use Inverse Binding Adapter in Kotlin for converting Lowercase text to Uppercase?
我正在創建一個 android 應用程序,我想在其中使用一個功能,在該功能中,我們輸入到 editText 字段中的文本可以在運行時僅在該特定 editText 字段中轉換為大寫。 我試過這段代碼 但它可以通過android中的反向綁定適配器的概念輕松完成。我嘗試參考https來實現它://dev ...
[英]How to use Inverse Binding Adapter in Kotlin for converting Lowercase text to Uppercase?
我正在創建一個 android 應用程序,我想在其中使用一個功能,在該功能中,我們輸入到 editText 字段中的文本可以在運行時僅在該特定 editText 字段中轉換為大寫。 我試過這段代碼 但它可以通過android中的反向綁定適配器的概念輕松完成。我嘗試參考https來實現它://dev ...
[英]Customising Androids XML Layout Field contentInsetStartWithNavigation
我將帶有工具欄的 AppBarLayout 放在一個單獨的文件中,並將其包含在我的活動布局中。 在某些屏幕上,布局需要在字段contentInsetStart和contentInsetStartWithNavigation上具有不同的維度。 字段contentInsetStart和contentI ...
[英]Android Databinding Cannot find a setter for * that accepts parameter type *
我試圖在數據綁定布局中聲明一個變量,它的類型是 integer 的數組,但在構建項目時出現錯誤找不到接受參數類型“int[]”的 <android.widget.LinearLayout app:availableGradesIndexes> 的設置器如果綁定適配器提供了設置器,請檢查 ...
[英]Android Xamarin AAR Binding enclosing type
我有一個.aar第三方庫,我想在 Xamarin Android 中使用它。 所以我創建了一個新的Android Bindings Library ,添加了aar -library 並將aar文件的Build action更改為LibraryProjectZip ,如下所述: https://doc ...
[英]RecyclerView not display all data when submiting list repeatedly
我正在創建 Notes 應用程序,它顯示來自本地數據庫的用戶注釋。 該應用程序運行良好,但是當我嘗試多次搜索(查詢)筆記時,某些數據不會顯示。 應用截圖: 顯示的實際數據重復搜索后數據不顯示 NotesViewModel 筆記片段 筆記適配器 BindingUtil list_item_note ...
[英]How to implement a custom view in a RecyclerView using a BindingAdapter
誰能幫助我使用綁定適配器在 RecyclerView(顯示一些speedcubing會話的數據)中使用自定義視圖( AAChartCore-Kotlin ,ChartView)? 我已經嘗試將 ChartView 添加到 RecyclerView 項目列表並在我調用 aa_drawChartWith ...
[英]Android DataBinding / BindingAdapter Error: { missing return statement }
Android DataBinding / BindingAdapter 錯誤:拋出錯誤:錯誤:將 function 傳遞給 BindingAdapter(塊:()-> 單元)時缺少返回語句。 | 綁定適配器.kt | activity_main.xml | 視圖模型.kt ...
[英]Binding adapter - cannot find setter for LiveData variable in recycler view
我正在嘗試使用 GridLayoutManager 實現 RecyclerView,但我被卡住了。 我收到錯誤: 當我試圖編譯時。 “打開文件”為我提供了 xml 回收站視圖聲明。 這是我的 BindingAdapter: 我如何稱呼上述內容: 這是我的屬性變量: 我知道 IDE 抱怨數據類型,我 ...
[英]Android Binding Adapter using same binding name on same View type but for different purpose
首先,我是數據綁定的新手,所以請不要因為我的(可能是愚蠢的)問題而評判我:)。 我想為例如app:data使用相同的綁定名稱到RecyclerView並將其綁定到提供List<MyModel>的ViewModel字段。 但是,我想為RecyclerView的不同實例使用不同的適配器(例如 ...
[英]UI not updating on MutableLiveData / ObservableField of List of custom objects property change with data binding
我正在使用對象列表和數據綁定的 ObservableField 在選項卡布局中生成選項卡。 完成某個操作后,我必須更新選項卡。 當我嘗試更改列表項的屬性時,UI 沒有更新。 下面是我的代碼。 我也嘗試過 MutableLiveData,但它也不起作用。 任何幫助表示贊賞。 ...
[英]How to load animated gif from drawable in ImageView using binding adapter?
我想在 ImageView 中顯示一個動畫文件。 但是我的 gif 文件 animation 無法正常工作。 ...
[英]Android MaterialButtonToggleGroup onButtonChecked DataBinding Not Supported
我想在MaterialButtonToggleGroup上使用 DataBinding 和MaterialButton ,但是似乎MaterialButtonToggleGroup沒有onButtonChecked屬性: 它無法編譯,顯示: Cannot find a setter for < ...
[英]Android MaterialButton Set Check in XML for DataBinding
我在MaterialButtonToggleGroup MaterialButton arrtribute android:checked不起作用,我可以在Activity或Fragment中使用setCheck() ,但是對於使用 DataBniding 我必須使用 XML 屬性。 有什么幫助 ...
[英]Simplify ViewState by removing Reloading state and just using Loading state
當我使用 SwipeRefreshLayout 刷新時,我不想隱藏 RecyclerView。 因此,我在 ViewState 類中引入了 Reloading 狀態: 這是我的綁定適配器: 是否有任何解決方案可以簡化 ViewState 類並刪除 Reloading 狀態(僅使用 Loadi ...
[英]Android RadioGroup Get Checked RadioButton Index (Position) in Two-way DataBinding
以下是我目前的解決方案: 這工作正常,但我想知道是否有更好的方法來做到這一點。 然后我發現RadioGroup有一個內置的雙向屬性: android:checkedButton (來自官方文檔),但是它是id而不是我想要的索引: 我仍然嘗試(使我的綁定表達式更短)但不起作用: 說"Cou ...
[英]DataBinding is not working Android Studio 4.1
我正在使用 Android Studio 4.1 和 Gradle gradle-6.5-all,但無法使用 DataBinding。 SDK 版本 下面是我的 XML、BindingAdapter 和 build.gradle 代碼。 在上面的代碼中,我試圖根據步數應用動態背景。但 ...
[英]Android Custom Library Module BindingAdapter Attribute Not Recognized
所以我剛剛學會了如何通過 Github 和 JitPack 發布我自己的庫(只是一些實用函數),這是我的代碼: https://github.com/xht418/Util-Kotlin/tree/main/utlikotlin/src/main/java/com/example/utlikot ...
[英]How can I binding different value for android:layout_marginLeft based LiveData<Boolean> in Android Studio?
代碼 B 運行良好。 aHomeViewModel.isHaveRecord是LiveData<Boolean> ,我希望根據marginLeft的值設置不同的aHomeViewModel.isHaveRecord 。 Bur Code A 得到以下編譯錯誤,我該如何解決? 找 ...
[英]Android custom view using custom binding adapter listener method with parameter
我正在開發一個自定義搜索視圖,我需要添加一個偵聽器,以便視圖模型可以使用數據綁定對查詢執行搜索,我目前在使用查詢參數設置綁定適配器時遇到問題,以下是相關部分: 這是帶有偵聽器事件的自定義視圖: 這是綁定適配器: 這是 XML 布局部分: 最后我在視圖模型中的方法: 當我編譯 XML ...