Is android:drawableStart in androidx.appcompat.widget.AppCompatButton supported by android 4.4? - android-button

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/Black"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/buttonFoo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableStart="#drawable/ic_foo_icon"
android:drawablePadding="8dp"
android:text="#string/foo" />
/androidx.appcompat.widget.LinearLayoutCompat>
The above activity layout would cause the following exception on Android 4.4 when the activity starts:
android.view.InflateException: Binary XML file line #123: Error inflating class <unknown>
It happens only on Android 4.4. All other devices are fine.
Everything will be fine if the following is removed:
android:drawableStart="#drawable/ic_foo_icon"
Is android:drawableStart in androidx.appcompat.widget.AppCompatButton supported by android 4.4?

Why don't you use drawableLeft / drawableRight instead?

Related

I need to create a OTP Screen where submit button should be disabled& once the boxes are filled button should be enabled &colour should change

<com.chaos.view.PinView
android:id="#+id/pvEnterPin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
app:itemCount="4"
style="#style/PinWidget.PinView"
android:cursorVisible="true"
app:cursorColor="#color/black"/>
I am using this library to create the Pinview.

2x NavHostFragments visible in LayoutInspector, but only 1 in my layouts

I have had this issue that seems kind of weird to me. When looking at my app through the Layout Inspector, I can see that my navHostFragment is nested inside itself for some reason:
However, here is what part of my layout file looks like:
<androidx.drawerlayout.widget.DrawerLayout 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"
android:id="#+id/activity_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:context=".core.MainActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/activity_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="#+id/navHostFragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
I do not inflate another navHostFragment in the fragment container view, so why is the navHostFragment duplicated in layout inspector? Is this somehow normal or is there a hidden navHostFragment being inflated somehow?
Well upon further testing it seems like this additional layer is generated when using <androidx.fragment.app.FragmentContainerView but isn't there when using the <fragment tag.
Since the FragmentContainerView is the recommended container, I assume the duplicate is unavoidable.
I do not know if this could be considered a bug in Fragments or if it is expected behavior.

why RecyclerView doesn't work in android 9

Although everything works well in android 8 and lower, but my RecyclerView doesn't load anything in android 9.
because I used Picasso in my recyclerView Adapter, I added code bellow to my AndroidManifest but nothing changed:
android:usesCleartextTraffic="true"
this is my RecyclerView XML code which is located in a MotionLayout:
<LinearLayout
android:id="#+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F6F6F6"
android:elevation="10dp"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_challenge"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
note that I have two recyclerView in my layout, the first one, works well
but the second one doesn't work!
Define a xml file, then add to your manifest
->> android:networkSecurityConfig="#xml/network_security_config"
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">secure.example.com</domain>
</domain-config>
</network-security-config>

Recyclerview not displaying list item but gray background and text "android...RecyclerView"

i am a new to Kotlin Android development,i added recycler view to my project and then move the icon to the layout according to the tutorial i was watching but it not displaying anything except gray background and this black text "andriod...recycler" instead of displaying the list items samples as in the tutorial
i suspect it the api level, the android studio version is 3.1
it on Api28, here is the activity_hobbies.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
this is HobbiesActivity.tk
package org.blessedmedia.www.kotlinapp
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
class HobbiesActivity : AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_hobbies)
}
}
if you need any more file to provide solution.kindly comment

Can the Android native CardView be used in Xamarin Forms XAML?

I've messed around as best I can but I can't find a way to embed the native xamarin.android CardView control within xamarin.forms xaml. Following is my code:
my namespaces
xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
xmlns:androidWidgetv7="clr-namespace:Android.Support.V7.Widget;assembly=Xamarin.Android.Support.v7.CardView;targetPlatform=Android"
xmlns:androidLocal="clr-namespace:MyApp.Droid;assembly=MyApp.Android;targetPlatform=Android"
My Xaml
<androidWidgetv7:CardView x:Arguments="{x:Static androidLocal:MainActivity.Instance}" View.HorizontalOptions="Center" View.WidthRequest="600" View.HeightRequest="300">
<androidWidget:TextView x:Arguments="{x:Static androidLocal:MainActivity.Instance}" Text="Simple Native Color Picker" TextSize="24" View.HorizontalOptions="Center"/>
</androidWidgetv7:CardView>
I get the following error
Exception is: XamlParseException - Position 32:18. Can not set the content of androidWidgetv7:CardView as it doesn't have a ContentPropertyAttribute
There are zero examples on the web showing how to do this. Anyone know?
You can't. but you can implement a similar version of it like how they did here.
you can find alternative versions here and here.
Don't expect to get android animations/touch gestures here.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:padding="5dp">
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="245dp"
android:layout_gravity="center_horizontal">
<TextView
android:text="Basic CardView"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</android.support.v7.widget.CardView>
</LinearLayout>