</pre><pre name="code" class="html"> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<com.mypackage.drawbleandtext.center.DrawableLeftCenterTextView
android:id="@+id/drawable_left"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:drawableLeft="@drawable/tab_focus"
android:gravity="center_vertical"
android:text="资料"
android:textColor="#000000"
android:textSize="18sp" />
<com.mypackage.drawbleandtext.center.DrawableLeftCenterTextView
自定义控件使用DrawableLeft/Right图片和文字同时居中
最新推荐文章于 2021-05-28 03:45:03 发布
本文介绍如何在Android中创建自定义控件,使得DrawableLeft和DrawableRight与文字在同一行内居中对齐。通过自定义布局和设置View的属性,可以实现这种效果。
摘要由CSDN通过智能技术生成