Skip to content

Instantly share code, notes, and snippets.

@kingori
Last active April 20, 2022 08:43
Show Gist options
  • Save kingori/fa4a71bf4e844b02d772d8c6d667fd32 to your computer and use it in GitHub Desktop.
Save kingori/fa4a71bf4e844b02d772d8c6d667fd32 to your computer and use it in GitHub Desktop.
Live template for ConstraintLayout xml attributes for Android
<templateSet group="ConstraintLayout">
<template name="cbb" value="app:layout_constraintBottom_toBottomOf=&quot;$cursor$&quot;" description="constraint bottom to bottom of id" toReformat="true" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cbp" value="app:layout_constraintBottom_toBottomOf=&quot;parent&quot;" description="constraint bottom to bottom of parent" toReformat="true" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cbt" value="app:layout_constraintBottom_toTopOf=&quot;$cursor$&quot;" description="constraint bottom to top of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cll" value="app:layout_constraintLeft_toLeftOf=&quot;$cursor$&quot;" description="constraint left to left of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="clp" value="app:layout_constraintLeft_toLeftOf=&quot;parent&quot;" description="constraint left to left of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="clr" value="app:layout_constraintLeft_toRightOf=&quot;$cursor$&quot;" description="constraint left to right of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="crl" value="app:layout_constraintRight_toLeftOf=&quot;$cursor$&quot;" description="constraint right to left of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="crp" value="app:layout_constraintRight_toRightOf=&quot;parent&quot;" description="constraint right to right of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="crr" value="app:layout_constraintRight_toRightOf=&quot;$cursor$&quot;" description="constraint right to right of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="ctb" value="app:layout_constraintTop_toBottomOf=&quot;$cursor$&quot;" description="constraint top to bottom of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="ctp" value="app:layout_constraintTop_toTopOf=&quot;parent&quot;" description="constraint top to top of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="ctt" value="app:layout_constraintTop_toTopOf=&quot;$cursor$&quot;" description="constraint top to top of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cpp" value="app:layout_constraintBottom_toBottomOf=&quot;parent&quot;&#10;app:layout_constraintEnd_toEndOf=&quot;parent&quot;&#10;app:layout_constraintStart_toStartOf=&quot;parent&quot;&#10;app:layout_constraintTop_toTopOf=&quot;parent&quot;&#10;" description="constraint center of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="css" value="app:layout_constraintStart_toStartOf=&quot;$cursor$&quot;" description="constraint start to start of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="csp" value="app:layout_constraintStart_toStartOf=&quot;parent&quot;" description="constraint start to start of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cse" value="app:layout_constraintStart_toEndOf=&quot;$cursor$&quot;" description="constraint start to end of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="ces" value="app:layout_constraintEnd_toStartOf=&quot;$cursor$&quot;" description="constraint end to start of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cep" value="app:layout_constraintEnd_toEndOf=&quot;parent&quot;" description="constraint end to end of parent" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
<template name="cee" value="app:layout_constraintEnd_toEndOf=&quot;$cursor$&quot;" description="constraint end to end of id" toReformat="false" toShortenFQNames="true">
<variable name="cursor" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
<option name="XML_TEXT" value="false" />
</context>
</template>
</templateSet>
@kingori
Copy link
Author

kingori commented Apr 22, 2018

적용방법: https://www.jetbrains.com/help/idea/sharing-live-templates.html 참고: 각 os 별 template 저장위치에 위 파일을 저장한다.

@kingori
Copy link
Author

kingori commented Jul 24, 2020

mac 기준 디렉터리 변경: ~/Library/Preferences/AndroidStudio4.0/templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment