Skip to main content

Components

Anchor Text

Actionable text link for users to navigate

banner-Anchor Text

Anchor text is text that can be clicked and hyperlinked with other sites or pages. The use of anchor text is very important in the world of content marketing because it can increase index and ranking on search engines.

android - anchor

Usage

To implement Anchortext we can use this tag LgnAnchorTextLarge or LgnAnchorTextSmall .

The following is usage to implement Anchortext in XML

<com.telkom.legion.component.anchortext.LgnAnchorTextLarge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_16dp"
android:layout_marginStart="@dimen/dimen_16dp"
android:text="Text Only"/>
<com.telkom.legion.component.anchortext.LgnAnchorTextSmall
android:layout_width="wrap_content"

Variants

We have two size variants, small and large variants

Large Size


Static in Xml

<com.telkom.legion.component.anchortext.LgnAnchorTextLarge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_16dp"
android:layout_marginStart="@dimen/dimen_16dp"
android:text="Text Only"/>

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnAnchorTextLarge(requiredContext()).apply {
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT


Small Size


Static in Xml

<com.telkom.legion.component.anchortext.LgnAnchorTextSmall
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dimen_16dp"
android:layout_marginStart="@dimen/dimen_16dp"
android:text="Text Only"/>

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnAnchorTextSmall(requiredContext()).apply {
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT


Attributes

Attribute NameXml AttrsRelated method(s)Description
Textandroid:texttextTo set Text value directly via xml
Enable Statusandroid:enabledisEnableTo set enable or disable anchor text directly via xml
Underlineapp:withUnderLineisWithUnderLineTo set underline anchor text directly via xml
Icon on Front Textapp:startIconDrawablestartIconDrawableTo set icon on front anchor text directly via xml
Icon on Behind Textapp:endIconDrawableendIconDrawableTo set icon on behind anchor text directly via xml
Anchor Text Colorapp:anchorTextColoranchorTextColorTo set color anchor text on enable state directly via xml
Anchor Text Color Disabledapp:anchorTextColorDisabledanchorTextColorDisabledTo set color anchor text on disable state directly via xml
Set Click ListenerN/AsetOnClickListener{ //Your Action }To set click listener