android - Include parent padding in selected state of TextView -


i have relativelayout padding , textview child. when textview selected, want highlighted area extend include padding of parent, entire relativelayout highlighted.

main.xml

<textview         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="hello world, myactivity"         android:textsize="30dp"         android:clickable="true"         android:background="@drawable/myback"         /> 

myback.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">     <item android:state_selected="true" android:drawable="@color/gray" />     <item android:state_focused="true" android:drawable="@color/gray" />     <item android:state_pressed="true" android:drawable="@color/gray" /> </selector> 

myactivity.java

package com.example.textviewpadding;  import android.app.activity; import android.os.bundle;  public class myactivity extends activity {     /**      * called when activity first created.      */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);     } } 

enter image description here

if want have behaviour, need add padding textview instead of relativelayout keep padding on parent @ 0.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -