CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2020-03-27
by Moustaf EL-Saghier

Original Post

Original - Posted on 2016-12-15
by Amir Uval



            
Present in both answers; Present only in the new answer; Present only in the old answer;

It's a simple workaround for that, to achieving the logic of percentage for width we can use two vertical `Guideline` that can split the screen into three sections:
This is a simple code I wrote for you:
``` <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.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:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:padding="22dp">
<TextView android:id="@+id/greenTextView" android:layout_width="0dp" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" android:textColor="@android:color/holo_green_dark" app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="Firdsfgsdfgasdsdfasdsdfsds" />
<TextView android:id="@+id/blueTextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:ellipsize="end" android:maxLines="1" android:textColor="@android:color/holo_blue_dark" app:layout_constrainedWidth="true" app:layout_constraintBaseline_toBaselineOf="@id/greenTextView" app:layout_constraintEnd_toStartOf="@+id/guideline3" app:layout_constraintStart_toStartOf="@+id/guideline" app:layout_constraintTop_toTopOf="parent" tools:text="Secoasdfsdfsdfsdfsdf.." />
<TextView android:id="@+id/orangetextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:ellipsize="end" android:maxLines="1" android:textColor="@android:color/holo_orange_dark" app:layout_constraintBaseline_toBaselineOf="@id/blueTextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/guideline3" tools:text="Third Very Long Text 123456789" />
<androidx.constraintlayout.widget.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.33" />
<androidx.constraintlayout.widget.Guideline android:id="@+id/guideline3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.66" /> </androidx.constraintlayout.widget.ConstraintLayout> ```
you can customize spaces by `margins`, any comments or modifications please tell me,cheers
It may be useful to have a quick reference here.<br/>
##Placement of views
Use a **guideline** with `app:layout_constraintGuide_percent` like this:
<androidx.constraintlayout.widget.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.5"/>
And then you can use this guideline as anchor points for other views.
###or
Use **bias** with `app:layout_constraintHorizontal_bias` and/or `app:layout_constraintVertical_bias` to modify view location when the available space allows
<Button ... app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_bias="0.25" ... />
##Size of views
Another percent based value is height and/or width of elements, with `app:layout_constraintHeight_percent` and/or `app:layout_constraintWidth_percent`:
<Button ... android:layout_width="0dp" app:layout_constraintWidth_percent="0.5" ... />

        
Present in both answers; Present only in the new answer; Present only in the old answer;