Pessoal, boa tarde.
Após criar o arquivo pacotes.json o arquivo item_pacote.xml não reconhece os tools:text e tools:src que apontam para "@sample/pacotes.json/pacotes/NOMEVARIAVEL".
A linha tools fica em vermelho como se o arquivo json não tivesse sido reconhecido. Já utilizei as opções Make Project, Clean Project, Rebuild Project, Sync with files e Sync with gradle files e mesmo assim nada:
item_pacote.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/item_pacote_imagem"
android:layout_width="0dp"
android:layout_height="100dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:src="@sample/pacotes.json/pacotes/imagem"
android:scaleType="centerCrop"/>
<TextView
android:id="@+id/item_pacote_local"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:padding="8dp"
tools:text="@sample/pacotes.json/pacotes/local"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="@android:color/white"
android:background="@android:drawable/screen_background_dark_transparent"
app:layout_constraintBottom_toBottomOf="@+id/item_pacote_imagem"
app:layout_constraintEnd_toEndOf="@+id/item_pacote_imagem"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/item_pacote_imagem"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<View
android:id="@+id/item_pacote_divisor"
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_marginBottom="8dp"
android:background="@android:color/holo_orange_dark"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_pacote_imagem" />
<TextView
android:id="@+id/item_pacote_dias"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@sample/pacotes.json/pacotes/dias"
android:layout_margin="8dp"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_pacote_divisor"
app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:id="@+id/item_pacote_preco"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@sample/pacotes.json/pacotes/preco"
android:textSize="20sp"
android:textColor="@android:color/holo_green_dark"
app:layout_constraintTop_toBottomOf="@id/item_pacote_dias"
app:layout_constraintStart_toStartOf="@id/item_pacote_dias"/>
</android.support.constraint.ConstraintLayout>
pacotes.json
{
"pacotes":[
{
"imagem" : "@drawable/sao_paulo_sp",
"local" : "São Paulo",
"dias" : "2 dias",
"preco" : "R$ 243,99"
},
{
"imagem" : "@drawable/Belo_Horizonte_mg",
"local" : "Belo Horizonte",
"dias" : "3 dias",
"preco" : "R$ 421,50"
},
{
"imagem" : "@drawable/recife_pe",
"local" : "Recife",
"dias" : "4 dias",
"preco" : "R$ 754,20"
},
{
"imagem" : "@drawable/rio_de_janeiro_rj",
"local" : "Rio de Janeiro",
"dias" : "6 dias",
"preco" : "R$ 532,55"
},
{
"imagem" : "@drawable/salvador_ba",
"local" : "Salvador",
"dias" : "5 dias",
"preco" : "R$ 899,99"
},
{
"imagem" : "@drawable/foz_do_iguacu_pr",
"local" : "Foz do Iguaçu",
"dias" : "1 dias",
"preco" : "R$ 289,90"
}
]
}