[英]Insert image as background set it bottom right corner inside Linear Layout
[英]How to position textview to the bottom right corner of the button using linear layout
我正在设计登录注销,但仍在设计中。 我想使用线性布局将文本视图放置在按钮的右角。 它不得在横向模式下更改其视图。
<?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="@color/colorPrimaryDark"
tools:context=".ForgotPassword">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.329" >
<Button
android:id="@+id/sendlink"
android:layout_width="236dp"
android:layout_height="51dp"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:onClick="send_link"
android:text="SEND LINK"
android:textSize="18sp"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="textEnd" //here i need to manage that situation
android:layout_gravity="end"
android:layout_marginRight="90dp">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="or"
android:textColor="#FD050000"
android:textSize="18sp"/>
<TextView
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="login"
android:layout_marginLeft="5dp"
android:text="Login?"
android:textColor="#071041"
android:textSize="16sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>
请帮忙,我希望文本“或注销”必须位于“发送链接”按钮右上角的底部。
这样吧
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark">
<Button
android:id="@+id/sendlink"
android:layout_width="236dp"
android:layout_height="51dp"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:onClick="send_link"
android:text="SEND LINK"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textSize="18sp"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="or"
android:textColor="#FD050000"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/login"
app:layout_constraintTop_toBottomOf="@+id/sendlink"/>
<TextView
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="login"
android:text="Login?"
android:textColor="#071041"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="@+id/sendlink"
app:layout_constraintTop_toBottomOf="@+id/sendlink"/>
</androidx.constraintlayout.widget.ConstraintLayout>
试试这个,很简单
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary">
<Button
android:id="@+id/sendlink"
android:onClick="send_link"
android:layout_width="236dp"
android:layout_height="51dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:text="SEND LINK"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:onClick="login"
android:text="or Login?"
android:textColor="#071041"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
你是这个意思吗
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="8dp"
android:textAlignment="textEnd"
app:layout_constraintEnd_toEndOf="@+id/sendlink"
app:layout_constraintTop_toBottomOf="@+id/sendlink">
<TextView
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:onClick="login"
android:text="or Login?"
android:textColor="#071041"
android:textSize="16sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
<Button
android:id="@+id/sendlink"
android:layout_width="236dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:onClick="send_link"
android:text="SEND LINK"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.