title: TextureView doesn't support displaying a background drawable Xamarin Android
body: <p>i have a problem with TextureView when i do inflate operation for camera2 implementation.</p>
  
  <p>i have the problem with Android 8 but it is work with samsung s5 Android 6.</p>
  
  <p>Error:</p>
  
  <pre><code>{Android.Views.InflateException: Binary XML file line #1: Error 
  inflating class md5773532591b176ca6c4550eebd08312bd.AutoFitTextureView 
  ---&gt; Java.Lang.Reflect.InvocationTargetException: Exception of type 
  'Java.Lang.Reflect.InvocationTargetException' was thrown. ---&gt; 
  Java.Lang.UnsupportedOperationException: TextureView doesn't support 
  displaying a background drawable
  --- End of inner exception stack trace ---
  --- End of inner exception stack trace ---
  --- End of managed Android.Views.InflateException stack trace ---
  android.view.InflateException: Binary XML file line #1: Error inflating 
  class md5773532591b176ca6c4550eebd08312bd.AutoFitTextureView
  Caused by: java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Constructor.newInstance0(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
  at android.view.LayoutInflater.createView(LayoutInflater.java:658)
  at 
  android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801)
  at 
  android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:874)
  at 
  android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:877)
  at 
  android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at Camera2BasicFragment.n_onCreateView(Native Method)
  at Camera2BasicFragment.onCreateView(Camera2BasicFragment.java:44)
  at android.app.Fragment.performCreateView(Fragment.java:2626)
  at 
  android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1279)
  at 
  android.app.FragmentManagerImpl.addAddedFragments
  (FragmentManager.java:2422)
  at android.app.FragmentManagerImpl.executeOpsTogether
  (FragmentManager.java:2201)
  at 
  android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute
  (FragmentManager.java:2155)
  at android.app.FragmentManagerImpl.execPendingActions
  (FragmentManager.java:2056)
  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
  at android.os.Handler.handleCallback(Handler.java:808)
  at android.os.Handler.dispatchMessage(Handler.java:101)
  at android.os.Looper.loop(Looper.java:166)
  at android.app.ActivityThread.main(ActivityThread.java:7425)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run
  (Zygote.java:245)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
  Caused by: java.lang.UnsupportedOperationException: 
  TextureView doesn't support displaying a background drawable
  at android.view.TextureView.setBackgroundDrawable(TextureView.java:321)
  at android.view.View.setBackground(View.java:20532)
  at android.view.View.&lt;init&gt;(View.java:5232)
  at android.view.View.&lt;init&gt;(View.java:4647)
  at android.view.View.&lt;init&gt;(View.java:4626)
  at android.view.TextureView.&lt;init&gt;(TextureView.java:148)
  at md5773532591b176ca6c4550eebd08312bd.AutoFitTextureView.&lt;init&gt; . 
  (AutoFitTextureView.java:29)
  ..
  </code></pre>
  
  <p>This is the AutoFitTextureView.cs</p>
  
  <pre><code>public class AutoFitTextureView : TextureView
  {
      private int mRatioWidth = 0;
      private int mRatioHeight = 0;........ link to pastebin
  </code></pre>
  
  <p><a href="https://pastebin.com/yC7Wvb60" rel="nofollow noreferrer">Code AutoFitTextureView</a></p>
  
  <p>And This is the xml </p>
  
  <pre><code>&lt;AutoFitTextureView
      android:id="@+id/camera2_content"
      android:layout_below="@id/header2_wrap"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_alignParentLeft="true"/&gt;........... link to pastebin
  </code></pre>
  
  <p><a href="https://pastebin.com/xHHSukUe" rel="nofollow noreferrer">Code xml</a></p>
  
  <p>i call the xml in Camera2BaseFragment so: </p>
  
  <pre><code>public override View OnCreateView(LayoutInflater inflater, ViewGroup 
  container, Bundle savedInstanceState)
      {
        return inflater.Inflate(Resource.Layout.Camera2BasicFragment, 
        container, false);
      }
  </code></pre>
  
  <p>i try to deleted the "AutoTextView" in xml and the inflate works.
  How can i solve the problem?
  Thanks.</p>