Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 像子弹一样在textView之前添加矢量图标-Android编程_Java_Android_Android Icons - Fatal编程技术网

Java 像子弹一样在textView之前添加矢量图标-Android编程

Java 像子弹一样在textView之前添加矢量图标-Android编程,java,android,android-icons,Java,Android,Android Icons,在最新的Android Studio中提供了新的矢量资源,我想在文本视图之前添加一个图标,比如图标/项目符号 在我的文本视图之前使用非常小的imageView并添加另一个图像看起来很奇怪。我尝试了android:icon,但没有成功 我基本上想使用矢量图标,比如字体图标。 我想在网页设计中为:Title-提供Java等价物。我已经在drawable文件夹中将ic_star.xml作为矢量资源提供,如何将此布局作为textView的前缀?您可以简单地将LinearLayout与android一起使

在最新的Android Studio中提供了新的矢量资源,我想在文本视图之前添加一个图标,比如图标/项目符号

在我的文本视图之前使用非常小的imageView并添加另一个图像看起来很奇怪。我尝试了
android:icon
,但没有成功

我基本上想使用矢量图标,比如字体图标。
我想在网页设计中为:
Title
-提供Java等价物。我已经在drawable文件夹中将
ic_star.xml
作为矢量资源提供,如何将此布局作为textView的前缀?

您可以简单地将LinearLayout与android一起使用:orientation=“horizontal”



查找文本视图复合绘图。这就是你想要的。

谢谢
android:drawableLeft=“@drawable/ic_star”
android:drawablePadding=“10dp”
正是我需要的!!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".MainActivity" >

    <ImageView
        android:id="@+id/imageButton"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/ic_star" />

    <TextView
        android:id="@+id/TextAct1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="This "
        android:textSize="20dp" />

</LinearLayout>