0
I have several buttons that readjust depending on the size of the device, however, the images inserted in it do not automatically adjust, and end up always with a fixed size. How can I make these images responsive?
<ImageView
android:id="@+id/imagem2"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="#9b1136"
android:src="@drawable/logove2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/botaoEmpresa"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/empresas"
android:text="Empresas"
/>
<Button
android:id="@+id/botaoContato"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/contato"
android:text="Contato"
/>
<Button
android:id="@+id/botaoRede"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/redes"
android:text="Redes Sociais"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:drawableTop="@drawable/servicosuteis"
android:text="Serviço uteis"
android:layout_weight="1" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:drawableTop="@drawable/desconto"
android:text="Mult Desconto"
android:layout_weight="1" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:drawableTop="@drawable/revista"
android:text="Revista"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="@+id/botaoRegiao"
android:layout_width="0dp"
android:layout_height="match_parent"
android:drawableTop="@drawable/mapa2"
android:text="Altere sua região"
android:layout_weight="1" />
</LinearLayout>
I wanted the images inside him to readjust, how can I solve this problem?
To official documentation teaches to customize the image of the button taking into account the size variations. The secret is to create images in the format Nine-patch.
– Piovezan