How to use standard attribute android:text in my custom view?

use this: public YourView(Context context, AttributeSet attrs) { super(context, attrs); int[] set = { android.R.attr.background, // idx 0 android.R.attr.text // idx 1 }; TypedArray a = context.obtainStyledAttributes(attrs, set); Drawable d = a.getDrawable(0); CharSequence t = a.getText(1); Log.d(TAG, “attrs ” + d + ” ” + t); a.recycle(); } i hope you got an idea

Custom vs User control

Choice is not only between user control and custom control, but among user control, custom control, customizing control template, customizing data template, header template (for collection based controls), attached properties. Refer to Control Authoring overview I go by following order of consideration Attached Properties : If functionality can be achieved, I use attached properties. Example, … Read more

Android – custom UI with custom attributes

Yes. Short guide: 1. Create an attribute XML Create a new XML file inside /res/values/attrs.xml, with the attribute and it’s type <?xml version=”1.0″ encoding=”UTF-8″?> <resources> <declare-styleable name=”MyCustomElement”> <attr name=”distanceExample” format=”dimension”/> </declare-styleable> </resources> Basically you have to set up one <declare-styleable /> for your view that contains all your custom attributes (here just one). I never … Read more

How can I get clickable hyperlinks in AlertDialog from a string resource?

I didn’t really like the currently most popular answer because it significantly changes the formatting of the message in the dialog. Here’s a solution that will linkify your dialog text without otherwise changing the text styling: // Linkify the message final SpannableString s = new SpannableString(msg); // msg should have url to enable clicking Linkify.addLinks(s, … Read more

What is the difference between a User Control Library and a Custom Control Library?

In practice custom controls are something you implement on the code level while you can use XAML for user controls. The custom controls extend one of the WPF control base classes and provide additional functionality through code so all the added logic and representation must be implemented inside the code. A user control is technically … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)