custom-component
Sane way to concat string and variable in Handlebars.js helper argument?
What you’re looking for the is the concat helper. Using it, your second example would become: {{#my-modal modal-id=(concat ‘add-item-‘ title) header=(concat ‘New ‘ title)}} <p>My body blabla</p> {{/my-modal}}
Use declare styleable to set custom component input type
Lets say you have a custom view named InputView, which is not a TextView (lets say its a RelativeLayout). In your attrs.xml: <declare-styleable name=”InputView”> <!– any custom attributes –> <attr name=”title” format=”string” /> <!– standart attributes, note android: prefix and no format attribute –> <attr name=”android:imeOptions”/> <attr name=”android:inputType”/> </declare-styleable> In an xml layout where you … Read more
Custom FragmentDialog with round corners and not 100% screen width
Dialog background: dialog_rounded_bg.xml <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”@android:color/white” /> <corners android:radius=”12dp” /> </shape> Dialog layout: dialog_rounded.xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:background=”@drawable/dialog_rounded_bg” android:minWidth=”260dp” android:orientation=”vertical” android:padding=”24dp”> … </LinearLayout> Dialog fragment: RoundedDialog.java public class RoundedDialog extends DialogFragment { … @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = … Read more
When to use , tag files, composite components and/or custom components?
What is the difference between those approaches? Facelet templates Use Facelet templates (as in <ui:composition>, <ui:include> and <ui:decorate>) if you want to split main page layout fragments into reuseable templates. E.g. header, menu, content, footer, etc. Examples: How to include another XHTML in XHTML using JSF 2.0 Facelets? What is the real conceptual difference between … Read more
Android – Writing a custom (compound) component
Use merge tag as your XML root <merge xmlns:android=”http://schemas.android.com/apk/res/android”> <!– Your Layout –> </merge> Check this article.