我刚开始使用Android,正在开发包含登录屏幕的第一个应用程序。
最初,我使用RelativeLayout
和AdView
或使用android:layout_alignParentBottom="true"
将任何其他视图正确放置在父级的底部。
然后,在阅读材料指南时,我指的是在LinearLayout
内使用ScrollView
的XML。现在,我无法将AdView
置于最底部位置(尝试将此XML导入Android Studio)。在这里搜索答案,我也将其放在RelativeLayout
内并再次使用android:layout_alignParentBottom="true"
但没有成功。我知道Android用户已玩过这一切,我希望他们可以帮助我。
所以,将我的基本问题列为:
ScrollView
进行登录屏幕活动的实际用途?如果您知道如何处理活动的UI,您是否可以在我应该使用的内容上发布两行或更多行?任何提示都将受到高度赞赏。 AdView
放在底部?我们将不胜感激。 感谢。 :)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="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:fitsSystemWindows="true"
android:background="#FFB74D">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="15dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:backgroundTintMode="src_atop">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="Gyaanify"
android:textSize="55sp"
android:textColor="#FF3D00"
android:textStyle="normal|bold"
android:textAllCaps="false"
android:textAlignment="center"
android:fontFamily="cursive"
android:layout_margin="10dp" />
</RelativeLayout>
<!-- Email Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<EditText android:id="@+id/etUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Email" />
</android.support.design.widget.TextInputLayout>
<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<EditText android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="Password"/>
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="24dp"
android:padding="20dp"
android:text="Login"
android:onClick="OnLogin"
android:background="#EF6C00"
android:textColor="@android:color/background_light" />
<TextView android:id="@+id/link_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="No account yet? Create one"
android:gravity="center"
android:textSize="16dip"
android:layout_marginTop="40dp" />
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Register @ Gyaanify"
android:onClick="OnRegister"
android:padding="20dp"
android:layout_marginTop="10dp"
android:background="#EF6C00"
android:textColor="@android:color/background_light" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
答案 0 :(得分:5)
每当您使用应填充整个屏幕的var v=document.querySelectorAll("#UsersDataTable [alt='Green']");
console.log(v.length);
时,它应具有<table class="table table-bordered" id="UsersDataTable">
<thead>
<tr>
<th>H0</th>
<th>H1</th>
<th>H2</th>
<th>H3</th>
<th>H4</th>
<th>H5</th>
</tr>
</thead>
<tbody>
<tr>
<td>C0</td>
<td>C1</td>
<td>C2</td>
<td>C3</td>
<td>C4</td>
<td><center><img src=".\pictures\green.jpg" class="img-circle" alt="Green" width="20" height="20"></center></td>
</tr>
</tbody>
属性。在您的代码中也是如此。但内部ScrollView
应该有android:layout_width="match_parent" android:layout_height="match_parent"
,如果你想到它就会有意义。
现在,要将LinearLayout
放在屏幕底部并让所有内容滚动到它上面,您需要以下布局结构:
android:layout_width="match_parent" android:layout_height="wrap_content"
将AdView
权重设置为1可确保您的AdView坚持到底部。