Android: Wie kann ich erreichen, das layout so?
Ich bin in der Lage, dies zu tun, verwenden Sie folgenden code. Aber problem ist "Shipping Address" und "1" TextView muss zentriert werden, um vertikale Linie(unterhalb der "1" sollte es sein, Zentrum der "Lieferadresse" TextView).
neccesary_part_of_layout.xml
<RelativeLayout
android:id="@+id/fcm_rl_scroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp">
<ProgressBar
android:id="@+id/mProgressBar"
style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:layout_centerInParent="true"
android:layout_weight="1"
android:focusable="false"
android:nestedScrollingEnabled="false"
android:progress="100"
android:progressDrawable="@drawable/custom_progress_bar"
android:secondaryProgress="100"
android:visibility="visible" />
<TextView
android:id="@+id/fcm_tv_step1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBaseline="@+id/mProgressBar"
android:layout_alignLeft="@+id/mProgressBar"
android:layout_alignStart="@+id/mProgressBar"
android:layout_centerVertical="true"
android:background="@drawable/bg_round_filled_white"
android:gravity="center"
android:text="1"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp16" />
<TextView
android:id="@+id/fcm_tv_step1text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/fcm_tv_step1"
android:layout_marginTop="@dimen/dp40"
android:text="Shopping Address"
android:textColor="@color/white"
android:textSize="@dimen/sp16" />
<TextView
android:id="@+id/fcm_tv_step22"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBaseline="@+id/mProgressBar"
android:layout_alignLeft="@+id/mProgressBar"
android:layout_alignStart="@+id/mProgressBar"
android:layout_centerVertical="true"
android:layout_marginLeft="150dp"
android:layout_toRightOf="@+id/fcm_tv_step1"
android:background="@drawable/bg_round_filled_white"
android:gravity="center"
android:text="2"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp16" />
<TextView
android:id="@+id/fcm_tv_step22text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/fcm_tv_step22"
android:layout_marginLeft="150dp"
android:layout_marginTop="@dimen/dp40"
android:layout_toRightOf="@+id/fcm_tv_step1text"
android:text="Address"
android:textColor="@color/white"
android:textSize="@dimen/sp16" />
</RelativeLayout>
Dies ist, was ich erreicht habe mit obigen code:
Problem im Detail:
Ich weiß ProgressBar
(Sie können jede Ansicht temporär) auf, das will ich TextView
mit Schritt-Nummern. und unterhalb jeder Zahl möchte ich Schritt Titel sowohl zentriert ausgerichtet, um jeden-anderen.
Wie kann ich das erreichen? Ich versuchte, um es im layout, sondern, dass Pausen Abhängigkeit mit Fortschrittsbalken.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Habe ich endlich das Problem gelöst mit
ConstraintLayout
. Dank 'Google' für die Bereitstellung solcher ein gutes layout, das ermöglicht eine bessere Anpassung.Kontaktieren Sie mich, wenn jemand will helfen, design diese Art von layout. Ich denke, ich bin Experte nun nutzen
ConstaintLayout
.Überprüfen Sie diese schöne Bibliothek für Schritt anzeigen https://github.com/baoyachi/StepView?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=3774
<com.baoyachi.stepview.HorizontalStepView android:id="@+id/step_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" />
mit id stepview0, stepview1 bis 5?