Gou*_*rav 4 android-linearlayout android-xml androidx
我正在AndroidX为我的 Android 项目使用依赖项。
我有一个Toolbar在我的活动中(这个活动是为了通过支付一些钱来支持开发人员)包裹在这样的线性布局中:
<LinearLayout
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:orientation="vertical"
android:background="@drawable/gradient"
tools:context=".Support">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_support"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@null"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
使用的其他 XML 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:orientation="vertical"
android:background="@drawable/gradient"
tools:context=".Support">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_support"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@null"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<TextView
android:layout_marginTop="150dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/google_sans"
android:textSize="17dp"
android:textColor="#ffffff"
android:text="@string/support_para"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#ffffff"
android:textSize="20dp"
android:text="$"/>
<EditText
android:id="@+id/amount"
android:layout_width="270dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="@string/pay_amount"
android:textColorHint="#ffffff"
android:textSize="20dp"
android:layout_marginStart="10dp"
android:layout_gravity="end"
android:maxLines="1" />
</LinearLayout>
<Button
android:id="@+id/googlepay"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:background="@drawable/round_button"
android:textColor="#ffffff"
android:fontFamily="@font/google_sans"
android:text="@string/pay"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
现在我得到的是这样的:
我得到了我自己问题的答案!
我的Support.java文件中有一行:
toolbar.bringToFront();
Run Code Online (Sandbox Code Playgroud)
我刚刚删除了它,它帮助了我
| 归档时间: |
|
| 查看次数: |
14281 次 |
| 最近记录: |