Jyo*_* JK 2 xml android android-layout
我不明白我的设计有什么问题。这是代码,
<RelativeLayout 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="wrap_content"
tools:context=".emi.advanced_emi.AdvancedEmiActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/adlayout"
android:layout_alignParentTop="true"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_advanced_emi" />
</android.support.design.widget.CoordinatorLayout>
<RelativeLayout
android:id="@+id/adlayout"
android:layout_width="match_parent"
android:layout_height="@dimen/adheight"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="@color/c5" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
content_advanced_emi 有一个滚动视图,其中有编辑文本和一些其他视图。这是代码的一部分,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/main_emiadvance"
android:scrollbars="none"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_margin="10dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1">
<TextView
android:padding="5dp"
android:gravity="center_vertical"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="match_parent"
android:textColor="@color/commontext"
android:text="Loan Amount "
android:textStyle="bold"/>
<EditText
android:background="@drawable/enabled_edittext"
android:padding="8dp"
android:inputType="numberDecimal"
android:id="@+id/loan"
android:layout_width="0dp"
android:maxLength="15"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:hint="Rs."/>
</LinearLayout>
....</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我的问题是当键盘打开时,键盘上方有一个额外的间隙(我猜是 50 dp)。我该如何解决?
我不能说额外的空间是什么,尽管评论提出了一些很好的建议。不过,我可以向您展示一种确定该空间性质的方法。
Android Studio 中有一个非常方便的工具,称为“布局检查器”。该工具将允许您查看模拟器或设备以查看显示的布局。
从“工具”菜单调用布局检查器:
在“选择流程”对话框中,选择您的流程。这是“MyApplication”的流程。
布局与屏幕图像一起显示。您可以单击树的各个部分或布局本身来查看内容。如果您在这里看到空白区域,您应该能够确定它的性质。
但是,如果您看不到自己的空间,则需要更深入地研究。要查看键盘,请再次调用布局检查器(工具->布局检查器)并选择持有键盘的进程。对我来说是这样,com.google.android.inputmethod.latin但对你来说可能会有所不同。
在这里我们可以看到位于键盘顶部的候选人列表。如果您在此处看到您的空格,则它是候选列表或连接到键盘的其他内容。
因此,这不是一个解决方案,但它应该可以帮助您走上正轨。
| 归档时间: |
|
| 查看次数: |
1557 次 |
| 最近记录: |