Category : android-xml

I am trying to pass a "@string" and "@stringarray" to my viewstub databinding via xml, but it does not work. I get the following error message: C:UserscensoredAndroidStudioProjectsexampleappbuildgeneratedsourcekaptdebugcomexampleappdatabindingAppStandardContactFormBindingImpl.java:943: error: cannot find symbol if (this.appDefaultCompanyNameEt.isInflated()) this.appDefaultCompanyNameEt.getBinding().setVariable(BR.hint, appDefaultCompanyNameEt.getResources().getString(R.string.app_contact_form_company_name)); ^ symbol: method getResources() location: variable appDefaultCompanyNameEt of type ViewStubProxy ViewStub inflated layout <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <data> <variable name="vBility" type="Boolean" ..

Read more

I am trying to pass a "@string" and "@stringarray" to my viewstub databinding via xml, but it does not work. I get the following error message: C:UserscensoredAndroidStudioProjectsexampleappbuildgeneratedsourcekaptdebugcomexampleappdatabindingAppStandardContactFormBindingImpl.java:943: error: cannot find symbol if (this.appDefaultCompanyNameEt.isInflated()) this.appDefaultCompanyNameEt.getBinding().setVariable(BR.hint, appDefaultCompanyNameEt.getResources().getString(R.string.app_contact_form_company_name)); ^ symbol: method getResources() location: variable appDefaultCompanyNameEt of type ViewStubProxy ViewStub inflated layout <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <data> <variable name="vBility" type="Boolean" ..

Read more

I have a simple composable function in com.example.Example.kt: @Preview @Composable fun ExampleComposable() { Text("Hello") } I tried to use ComposeViewAdapter like below: <androidx.compose.ui.tooling.ComposeViewAdapter android:layout_width="match_parent" android:layout_height="match_parent" tools:composableName="com.example.ExampleKt" /> Android Studio does not show any preview of the composable in the design pane. Also, how is ComposeViewAdapter different from androidx.compose.ui.platform.ComposeView? Source: Android..

Read more

I’ve got a simple layout: <?xml version="1.0" encoding="utf-8"?> <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" tools:context=".pkgFragment.PrepareVehicleFragment" xmlns:bind="http://schemas.android.com/apk/res-auto" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" > <include layout="@layout/toolbar_returnicon_text" android:id="@+id/abLayoutAddVehicle" bind:tvText="@{@string/_1_tank}" /> </RelativeLayout> </ScrollView> Which imports the following layout: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <data> <variable name="tvText" type="java.lang.String"/> </data> <com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/BrightYellowCrayola" > <androidx.appcompat.widget.Toolbar ..

Read more

New to Android (Java) development and I have a fragment (WidgetFragment) that is backed by a binding to a widget.xml file. WidgetFragment: public class WidgetFragment extends Fragment { private WidgetBinding binding; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { binding = WigetBinding.inflate(inflater, container, false); return binding.getRoot(); } public void onViewCreated(@NonNull View view, Bundle ..

Read more

I am trying to implement lesson ViewModel and data binding, in the below xml, I want to use TextUtils.isEmpty() method to check if editText is empty then set error, while I searching for this I found this question I added importing TextUtils in the tag, but I still cannot call editText "name_text" from button onClick ..

Read more

I m implementing the huawei ads in the android Application. I have go through all the https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/publisher-service-banner-0000001050066915 and successfully implemented the ads but android studio preview is giving me error and is not displaying the preview when adding the huawei ads in the xml. After Removing the Huawei Ads preview is showing. Following is the ..

Read more

I need space between items in LinearLayout without padding on the sides. This image will explain it: This is the XML: <LinearLayout android:layout_width="240dp" android:layout_height="match_parent" android:layout_marginBottom="32dp" android:orientation="horizontal"> <ImageView android:id="@+id/rateOneStar" android:layout_width="32dp" android:layout_height="32dp" android:layout_weight="1" app:srcCompat="@drawable/ic_star" app:tint="@color/ratingStarInactive" /> <ImageView android:id="@+id/rateTwoStar" android:layout_width="32dp" android:layout_height="32dp" android:layout_weight="1" app:srcCompat="@drawable/ic_star" app:tint="@color/ratingStarInactive" /> <ImageView android:id="@+id/rateThreeStar" android:layout_width="32dp" android:layout_height="32dp" android:layout_weight="1" app:srcCompat="@drawable/ic_star" app:tint="@color/ratingStarInactive" /> <ImageView android:id="@+id/rateFourStar" android:layout_width="32dp" android:layout_height="32dp" android:layout_weight="1" ..

Read more