1

I am using a custom inflater to inflate a layout. I have the rootView of the layout. Now I want to check for all the child views that have text attr set in it.

 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/hello_world"

The child view could be anything (TextView, Labelm EditText, etc.). How can I get the attributes defined for a view. I tried the following code but couldn't get the string (returns null)

int[] textSizeAttr = new int[] { android.R.attr.text };
TypedValue typedValue = new TypedValue(); 
TypedArray a= childView.getContext().obtainStyledAttributes(typedValue.data, textSizeAttr);

How do I get the attributes of a view? Thanks in advance.

Rahul
  • 91
  • 1
  • 8
  • 2
    @Guru_VL I am not using any custom view. I just want the attributes of the view defined in any given layout xml file. I am using a custom inflater hoping to get those details. Is there any other way to do it? – Rahul Feb 25 '16 at 16:57
  • I am creating a library that will change the text being displayed on any application. I want to know how can I get all the view and their text value? – Rahul Feb 28 '16 at 02:11
  • Do you have any updates? – Kacper Sierakowski Feb 25 '22 at 09:59

0 Answers0