Skip to main content

Existe uma forma de acessar oum Vector do Androd na classe Javade forma programável?

TenoTenho um vector de uma estrela e queria acessar um path dele de dentro da minaminha classe Java para mudar a cor.

<vector android:height="24dp" android:viewportHeight="197.24483"
    android:viewportWidth="207.1335" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615 6.993,3.402z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615h-7.371z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l10.867,-15.214 5.008,6.237z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l-3.496,-18.615 -7.182,3.591z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l17.859,-1.512 -1.984,-7.465z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
 

inserir a descrição da imagem aqui

Existe uma forma de acessar o Vector do Androd na classe Java?

Teno um vector de uma estrela e queria acessar um path dele de dentro da mina classe Java para mudar a cor.

<vector android:height="24dp" android:viewportHeight="197.24483"
    android:viewportWidth="207.1335" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615 6.993,3.402z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615h-7.371z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l10.867,-15.214 5.008,6.237z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l-3.496,-18.615 -7.182,3.591z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l17.859,-1.512 -1.984,-7.465z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
 

inserir a descrição da imagem aqui

Existe uma forma de acessar um Vector de forma programável?

Tenho um vector de uma estrela e queria acessar um path dele de dentro da minha classe Java para mudar a cor.

<vector android:height="24dp" android:viewportHeight="197.24483"
    android:viewportWidth="207.1335" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615 6.993,3.402z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615h-7.371z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l10.867,-15.214 5.008,6.237z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l-3.496,-18.615 -7.182,3.591z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l17.859,-1.512 -1.984,-7.465z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
 

inserir a descrição da imagem aqui

Fonte Link
Ilgner de Oliveira
  • 1,1mil
  • 3
  • 16
  • 33

Existe uma forma de acessar o Vector do Androd na classe Java?

Teno um vector de uma estrela e queria acessar um path dele de dentro da mina classe Java para mudar a cor.

<vector android:height="24dp" android:viewportHeight="197.24483"
    android:viewportWidth="207.1335" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615 6.993,3.402z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l3.874,-18.615h-7.371z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l10.867,-15.214 5.008,6.237z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l-3.496,-18.615 -7.182,3.591z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
    <path android:fillColor="#00000000"
        android:pathData="m103.377,106.274 l17.859,-1.512 -1.984,-7.465z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
 

inserir a descrição da imagem aqui