gpt4 book ai didi

java - 如何在标签 View android java中实现循环UI

转载 作者:行者123 更新时间:2023-12-05 00:14:37 26 4
gpt4 key购买 nike

我正在为一个客户开发一个项目,他们给了我一个 UI,我必须在其中实现某个选项卡(例如布局),我想知道如何在 Android 上实现这种选项卡。我附上了下面的图片。任何帮助将不胜感激。

我想要实现的目标的快照

最佳答案

If you don't mind then this answer is not based on circular UI in tab view android java but it almost fulfills your need.

输出(请不要介意应用程序名称):

您可以使用以下 XML 代码来实现您的需求:

<?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:layout_gravity="center"
android:background="#EDFAFF"
tools:context=".MainActivity">


<ImageView
android:id="@+id/personalInfoTab"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="50dp"
android:layout_marginTop="30dp"
android:contentDescription="@string/app_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/radio_btn_checked"
app:tint="@color/black" />

<ProgressBar
android:id="@+id/personalInfoProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginStart="-4dp"
android:max="100"
app:layout_constraintBottom_toBottomOf="@+id/personalInfoTab"
app:layout_constraintStart_toEndOf="@+id/personalInfoTab"
app:layout_constraintTop_toTopOf="@+id/personalInfoTab" />

<ImageView
android:id="@+id/paymentTab"
android:layout_width="30dp"
android:layout_height="30dp"
app:layout_constraintBottom_toBottomOf="@+id/personalInfoProgress"
app:layout_constraintEnd_toStartOf="@+id/paymentProgressBar"
app:layout_constraintStart_toEndOf="@+id/personalInfoProgress"
app:layout_constraintTop_toTopOf="@+id/personalInfoProgress"
app:srcCompat="@drawable/ic_baseline_circle_24"
app:tint="#353535" />

<ProgressBar
android:id="@+id/paymentProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="120dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/paymentTab"
app:layout_constraintEnd_toStartOf="@+id/confirmationTab"
app:layout_constraintTop_toTopOf="@+id/paymentTab" />

<ImageView
android:id="@+id/confirmationTab"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="50dp"
app:layout_constraintBottom_toBottomOf="@+id/paymentProgressBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/paymentProgressBar"
app:srcCompat="@drawable/ic_baseline_circle_24"
app:tint="#353535" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Personal Info"
app:layout_constraintEnd_toStartOf="@+id/personalInfoProgress"
app:layout_constraintStart_toStartOf="@+id/personalInfoTab"
app:layout_constraintTop_toBottomOf="@+id/personalInfoTab" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Payment"
app:layout_constraintEnd_toStartOf="@+id/paymentProgressBar"
app:layout_constraintStart_toEndOf="@+id/personalInfoProgress"
app:layout_constraintTop_toBottomOf="@+id/paymentTab" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Confirmation"
app:layout_constraintEnd_toEndOf="@+id/confirmationTab"
app:layout_constraintStart_toEndOf="@+id/paymentProgressBar"
app:layout_constraintTop_toBottomOf="@+id/confirmationTab" />

//frameLayout for your fragments
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2">

</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

现在您可以增加进度,并且可以在不同页面使用 fragment ,即:个人信息付款确认

关于java - 如何在标签 View android java中实现循环UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70909429/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com