I've a button and i need to use this same button with same proprieties in all my projects and i want to create a component to just call this component and if i need to change my button, change in just one class do change all the uses.
I have this button:
<br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
android:id="@+id/createMatch"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:background="@color/buttonColor"
android:layout_marginTop="16dp"
app:spinning_bar_width="4dp"
app:spinning_bar_color="#FFF"
android:alpha="0.5"
android:textColor="@color/colorAccent"
android:elevation="4dp"
android:enabled="false"
android:layout_marginLeft="16dp"
android:textStyle="bold"
android:text="@string/createMatch"
android:textSize="14sp"
app:spinning_bar_padding="6dp"/>
I create a class extending CircularProgressButton but some proprieties i don't have ideia how to access in the code. The proprieties with app: for example.
Merging two questions, how i make a component with a layout with various itens?
for example:
<LinearLayout>
<Toolbar/>
<LinearLayout/>
</LinearLayout>
I want to compose this xml in a class to call and get all this itens in all the layouts using my custom class.
<MyLinearLayout>
...
</MyLinearLayout>
Have a look here. You will have to subclass a View and provide a constructor that takes a Context and AttributeSet.
You might have noticed the use of
R.styleable.CircleView_titleText
in my example. Before using custom attributes, you have to tell the compiler about them. This is achieved by adding a.xml
defining your attributes and their expected format.Reusable Layouts is probably what you are looking for.
An example of this would be to define a custom toolbar as
toolbar.xml
.and then
include
it in other views: