Placeholder

public class Placeholder
extends View

java.lang.Object
   ↳ android.view.View
     ↳ android.support.constraint.Placeholder


Added in 1.1

A Placeholder provides a virtual object which can position an existing object.

When the id of another view is set on a placeholder (using setContent()), the placeholder effectively becomes the content view. If the content view exist on the screen it is treated as gone from its original location.

The content view is positioned using the layout of the parameters of the Placeholder (the Placeholder is simply constrained in the layout like any other view).

Summary

Inherited constants

Inherited fields

Public constructors

Placeholder(Context context)
Placeholder(Context context, AttributeSet attrs)
Placeholder(Context context, AttributeSet attrs, int defStyleAttr)
Placeholder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

View getContent()

Returns the content view

int getEmptyVisibility()

Returns the behaviour of a placeholder when it contains no view.

void setContentId(int id)

Sets the content view id

void setEmptyVisibility(int visibility)

Sets the visibility of placeholder when not containing objects typically gone or invisible.

Inherited methods

Public constructors

Placeholder

public Placeholder (Context context)

Parameters
context Context

Placeholder

public Placeholder (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Placeholder

public Placeholder (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Placeholder

public Placeholder (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

getContent

public View getContent ()

Returns the content view

Returns
View null if no content is set, otherwise the content view

getEmptyVisibility

public int getEmptyVisibility ()

Returns the behaviour of a placeholder when it contains no view.

Returns
int Either View.VISIBLE, View.INVISIBLE, View.GONE. Default is INVISIBLE

setContentId

public void setContentId (int id)

Sets the content view id

Parameters
id int: the id of the content view we want to place in the Placeholder

setEmptyVisibility

public void setEmptyVisibility (int visibility)

Sets the visibility of placeholder when not containing objects typically gone or invisible. This can be important as it affects behaviour of surrounding components.

Parameters
visibility int: Either View.VISIBLE, View.INVISIBLE, View.GONE