Answer the question
In order to leave comments, you need to log in
How to hide and show icons in RelativeLayout?
there is a RelativeLayout in it there are several checkboxes with answers, you need to select one or more answers, then press the check button and after pressing the button one icon should appear opposite the correct answer and another icon opposite the wrong one!
The question is, how can you display an icon on a RelativeLayout ?
Then how to display it on pressing the button?
here is the layout itself
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.apps.partizanin.androidappzno.MainActivity"
tools:showIn="@layout/app_bar_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ParagraphLabelValue"
android:id="@+id/paragraphLabel"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:textSize="15sp"
android:textIsSelectable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/paragraphValue"
android:textSize="15sp"
android:textIsSelectable="true"
android:layout_alignTop="@+id/paragraphLabel"
android:layout_toEndOf="@+id/paragraphLabel"
android:layout_marginStart="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/taskLabel"
android:textSize="15sp"
android:textIsSelectable="true"
android:text="@string/TaskLabelValue"
android:layout_below="@+id/paragraphLabel"
android:layout_alignEnd="@+id/paragraphLabel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/taskValue"
android:textSize="15sp"
android:textIsSelectable="true"
android:layout_alignTop="@+id/taskLabel"
android:layout_toEndOf="@+id/taskLabel"
android:layout_marginStart="5dp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="@+id/checkBox2"
android:layout_alignParentStart="true"
android:layout_below="@+id/checkBox1"
android:layout_alignParentLeft="true" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="@+id/checkBox1"
android:layout_below="@+id/paragraphLabel"
android:layout_alignParentStart="true"
android:layout_marginTop="196dp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="@+id/checkBox3"
android:layout_alignParentStart="true"
android:layout_below="@+id/checkBox2"
android:layout_alignParentLeft="true" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="@+id/checkBox4"
android:layout_alignParentStart="true"
android:layout_below="@+id/checkBox3"
android:layout_alignParentLeft="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/questionText"
android:layout_below="@+id/paragraphLabel"
android:layout_marginTop="61dp"
android:layout_alignEnd="@+id/taskLabel"
android:layout_toEndOf="@+id/paragraphLabel" />
</RelativeLayout>
Answer the question
In order to leave comments, you need to log in
And what is the actual problem?
Throw icons in front of the checkboxes, make them invisible, and when they answer, make them visible, or simply do not initially load the picture, but load the visible one after the
upd response
view.setVisibility
(View.VISIBLE);
invisible
view.setVisibility(View.INVISIBLE);
or
view.setVisibility(View.GONE);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question