<RelativeLayout
android:layout_weight="1"
android:layout_marginLeft="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/checkimage"
android:layout_width="16dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:src="@drawable/greentickmark"
android:layout_height="16dp" />
<LinearLayout
android:id="@+id/clicklayout"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/click"
android:layout_gravity="center"
android:background="@drawable/background"
android:layout_width="60dp"
android:layout_height="50dp" />
<TextView
android:textStyle="bold"
android:textSize="10dp"
android:layout_marginTop="4dp"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
If i click on click id Image View then layout background color is changed but check image is not visible.How to show this check image and change background color.
public void onClick(View v) { checkimage.setVisibility(View.VISIBLE);
clicklayout.setBackgroundColor(Color.parseColor("#2f0058")); }
<RelativeLayout
android:layout_weight="1"
android:layout_marginLeft="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/clicklayout"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/click"
android:layout_gravity="center"
android:background="@drawable/background"
android:layout_width="60dp"
android:layout_height="50dp" />
<TextView
android:textStyle="bold"
android:textSize="10dp"
android:layout_marginTop="4dp"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="@+id/checkimage"
android:layout_width="16dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:src="@drawable/greentickmark"
android:layout_height="16dp" />
</RelativeLayout>
your linear layout overlaping the imageview so.. hope this helps..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.