• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Change Styles onPressed

Hello,
I have a Area with some elements: ImageView and TextView
These elements are in an RelativLayout.
The RelativeLayout has an onClick Listener.

Now, I want to change all Colors on the regarding elements.
Background of RelativLayout, src of ImageView, textColor of TextView and so on

Is it possible to have an onPressed Listener on a RelativLayout or so.
Or maybe somebody have an idea, how I could make an complex Element where some data will change, when it is pressed.

Here my part:
Code:
<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="50px"
        android:onClick="onClickActual">
            <ImageView 
                    android:id="@+id/lk_txt_actual"
                    android:src="@drawable/home_image"
                    android:layout_alignParentLeft="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="20dp"
                    android:layout_centerInParent="true" />
                    
            <TextView
                    android:id="@+id/home_num_actual"
                    android:layout_alignParentRight="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=""
                    android:textColor="@color/btn_text"
                    android:layout_marginRight="20dp"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingBottom="2dp"
                    android:layout_centerVertical="true"
                    style="@style/home_menu_num"
                    android:visibility="invisible"
                    android:background="@drawable/home_num_shape"/>
            
    </RelativeLayout>
 
Back
Top Bottom