Skip to main content
Give us your valuable feedback

It will help us understand how we can serve you better

Give feedback


View State

View that displays different content based on its state.

banner-View State
Component Status Details

Status component contains a list of checks and completeness that has been tested and owned by each component

We don't use color as the only visual tool to convey information.
The component’s structure and properties include relevant options such as variant, style, size, orientation, optional iconography, decorations, selection, error state, etc. The title is the component name that uses the frame base component template. The base component name contains: .Base & "Component Name" if there is more than one. All component properties use the Legion foundation.
We can change all the parts that are connected to the component base. The inside of the base component remains connected to the master component. All variant options are not damaged when we change from one to another. Overriding changes to components will not reset other variants.
Component's already has component specs documentation.



Upcoming Upcoming


Views are responsible for managing their own state. Android View displays different content based on its state. View state in Legion is implemented based on base components forking from Kennyc1012/MultiStateView with some modification and some improvement.

Legion provides 4 different states, where we can customize activities to each layout state.

Default Content

This is default state provided by Legion.

viewstate android default


This is state that we can use when we have nothing to show in view.

viewstate android empty


This is state that we can use when we have an error activity in view.

viewstate android error


This is state that we can use when we still waiting for an activity in view.

viewstate android loading

How to use

Static usage in XML


Change State

with(binding) {
lifecycleScope.launch { //For sample we use coroutine delay for automatic change state
//Change to Content View
msvSample.viewState = ViewState.CONTENT
// Or Use Extension Function
delay(1000)ewState.LOADING))) {

Modify Layout In State

with(binding) {
//For sample we use state loading with layout : layout_sample_one.xml
with(LayoutSampleOneBinding.bind(msvSample.getView(ViewState.LOADING))) {
//Do Whatever you want with layout


Attribute NameXml AttrsRelated method(s)Description
View Stateapp:viewStateviewStateTo set View State in Layout
Loading Viewapp:loadingViewN/ATo set Loading View Layout
Empty Viewapp:emptyViewN/ATo set Empty View Layout
Error Viewapp:errorViewN/ATo set Error View Layout