Your Styleable is:
<declare-styleable name="TextView">
<attr name="DataContext" format="string" />
<attr name="Text" format="string" />
</declare-styleable>
Call it where you want with this:
custom:DataContext="@string/xxxx"
In your Code:
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TextView);
int n = a.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = a.getIndex(i);
switch (attr) {
case R.styleable.TextView_DataContext:
title = a.getString(attr);
break;
case R.styleable.TextVie_Text:
//Any you want
break;
default:
Log.d("TAG", "Unknown attribute for " + getClass().toString() + ": " + attr);
break;
}
}
a.recycle();