除了使用drawables作为TextVIEw的复合物之外,一切似乎都适合我.
通常,人们可以这样做:
customTab.setCompoundDrawablesWithIntrinsicBounds( 0,R.drawable.my_vector,0 );
不幸的是,目前还没有工作,我无法找到解决此问题的方法.
正如帖子所述,唯一可用和工作的方法是xml,使用app:srcCompat =“@ drawable / …”和Java setimageResource(…)
如何使用setCompoundDrawable()方法使用新的矢量drawable支持?
提前致谢.
编辑:
根据要求,这是VectorDrawableCompat类的结果:
xml是:
<?xml version="1.0" enCoding="utf-8"?><vector xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:wIDth="24dp" androID:height="24dp" androID:vIEwportWIDth="98" androID:vIEwportHeight="102"><path androID:fillcolor="#4D4D4D" androID:strokeWIDth="2" androID:strokecolor="#4D4D4D" androID:pathData="M63.3336386,72.2631001 C56.7778507,76.902124248.7563953,79.630740440.09319,79.6307404 C17.9503315,79.6307404 0,61.804793 0,39.8153702C0,17.8259473 17.9503315,0 40.09319,0 C62.2360484,0 80.1863799,17.825947380.1863799,39.8153702 C80.1863799,50.8100816 75.6987973,60.763924268.4433567,67.9690887 L96.7320074,96.0617174 C98.0293966,97.350116597.9978616,99.4159703 96.6953405,100.709466 C95.3837385,102.01197993.2974318,102.019264 92.0151615,100.745879 L63.3336386,72.2631001L63.3336386,72.2631001 L63.3336386,72.2631001 Z M40.09319,74.9465792C59.6310061,74.9465792 75.4695341,59.217802 75.4695341,39.8153702C75.4695341,20.4129383 59.6310061,4.6841612 40.09319,4.6841612C20.5553738,4.6841612 4.71684588,20.4129383 4.71684588,39.8153702C4.71684588,59.217802 20.5553738,74.9465792 40.09319,74.9465792L40.09319,74.9465792 L40.09319,74.9465792 Z" /></vector>解决方法 从 support library 23.2开始,您可以使用下一个解决方案:
Drawable drawable=AppCompatDrawableManager.get().getDrawable(mContext,R.drawable.drawable);vIEw.setCompoundDrawablesWithIntrinsicBounds(null,drawable,null,null);总结
以上是内存溢出为你收集整理的Android VectorDrawable作为复合抽屉全部内容,希望文章能够帮你解决Android VectorDrawable作为复合抽屉所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)