This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<TextView | |
android:id="@+id/button1_txt" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:elevation="8dp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BindView(R.id.constraint_layout) | |
ConstraintLayout mConstraintLayout; | |
ConstraintSet constraintSet; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_home); | |
ButterKnife.bind(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/constraint_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="#263238"> | |
<View | |
android:id="@+id/space_background" | |
android:layout_width="140dp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BindView(R.id.constraint_layout) | |
ConstraintLayout mConstraintLayout; | |
ConstraintSet csMovieDetails, csMovieDetailsExpanded; | |
boolean isExpanded; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main_full); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/constraint_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.constraint.Guideline | |
android:id="@+id/left_margin" | |
android:layout_width="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/constraint_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.constraint.Guideline | |
android:id="@+id/left_margin" | |
android:layout_width="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<View | |
android:id="@+id/widget" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintSet c = new ConstraintSet(); | |
c.clone(constraintLayout); | |
c.constrainHeight(R.id.image, ConstraintSet.MATCH_CONSTRAINT); | |
c.constrainWidth(R.id.image, ConstraintSet.MATCH_CONSTRAINT); | |
c.setDimensionRatio(R.id.image, "16:9"); | |
c.connect(R.id.image, ConstraintSet.LEFT, R.id.left_ruler, ConstraintSet.LEFT); | |
c.connect(R.id.image, ConstraintSet.RIGHT, R.id.right_ruler, ConstraintSet.RIGHT); | |
c.applyTo(mConstraintLayout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintSet c = new ConstraintSet(); | |
c.clone(constraintLayout); | |
//c.create( R.id.keyline, ConstraintSet.VERTICAL_GUIDELINE); | |
c.setGuidelineBegin(R.id.keyline, ScreenUtil.convertDptoPx(16)); | |
c.connect(R.id.button, ConstraintSet.START, R.id.keyline, ConstraintSet.END); | |
c.applyTo(constraintLayout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintSet method | Explanation | |
---|---|---|
create(int guidelineID, int orientation) | Creates a guideline within the layout. | |
setGuidelineBegin(int guidelineID, int margin) | Sets a guideline's distance from parent's left edge (vertical guideline) or top edge (horizontal guideline). | |
setGuidelineEnd(int guidelineID, int margin) | Sets a guideline's distance from parent's right edge (vertical guideline) or bottom edge (horizontal guideline). | |
setGuidelinePercent(int guidelineID, float ratio) | Sets a guideline's position in percentage relative to parent view group. |