【发布时间】:2018-05-09 11:56:40
【问题描述】:
我在Fragment 中的TabLayout 中有一个floating action button。
页面加载时,按钮保持如下:
点击“Quilometragem final”字段后,键盘出现,然后我的按钮保持在正确的位置:
如何解决此问题,以便在页面加载时将我的 floating action button 显示在正确的位置?
这是我的布局的 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"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginLeft="@dimen/common_margin"
android:layout_marginRight="@dimen/common_margin">
<!-- another fields -->
<!-- KM FINAL -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:text="@string/end_exam_mileage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="25sp"
android:fontFamily="sans-serif-condensed"
android:textColor="@color/primary" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txtFinalKM"
android:fontFamily="sans-serif-condensed"
android:inputType="number"
android:hint="@string/end_exam_insert_mileage"
android:textSize="25sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<!-- NEXT BUTTON -->
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab_next_information"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginRight="@dimen/common_margin"
android:layout_marginBottom="@dimen/common_margin"
android:src="@drawable/icon_fab_mini_next"
android:clickable="true"
app:fab_shadowColor="#00FFFFFF"
app:fab_colorNormal="#272B35"
app:fab_colorPressed="@color/accent"
app:fab_colorRipple="#272B35" />
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
【问题讨论】:
-
@AswinPAshok 非常感谢!
-
很高兴你成功了..
标签: android xamarin.android android-tablayout floating-action-button