Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 布局权重未正确缩放图元_Java_Android_Android Layout_Android Linearlayout - Fatal编程技术网

Java 布局权重未正确缩放图元

Java 布局权重未正确缩放图元,java,android,android-layout,android-linearlayout,Java,Android,Android Layout,Android Linearlayout,我正在尝试使用layout\u weight使按钮正好出现在EditText字段的右侧 然而,情况就是这样: 有没有办法让编译后的版本看起来像我的设计视图 这是我的设计观点 这是我的布局代码: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pa

我正在尝试使用
layout\u weight
使按钮正好出现在
EditText
字段的右侧

然而,情况就是这样:

有没有办法让编译后的版本看起来像我的设计视图

这是我的设计观点

这是我的布局代码:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:padding="10dp"
android:scrollbars="none"
tools:context="com.mycomapany.myapp.Views.MasterDetails.VehicleFragment">


<LinearLayout
android:id="@+id/llMainView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">


../// OTHER ELEMENTS

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<android.support.design.widget.TextInputLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="2"
    android:hint="VIN">

    <android.support.design.widget.TextInputEditText
        android:id="@+id/editVIN"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginEnd="5dp"
        android:background="@color/COLOR_TXI_GREY"
        android:imeOptions="actionDone"
        android:inputType="text"
        android:maxLength="17"
        android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>

<ProgressBar
    android:id="@+id/pbCheckVIN"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:visibility="gone"/>

<Button
    android:id="@+id/btnScanVIN"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:background="@color/COLOR_TXI_BLUE"
    android:text="SCAN"
    android:textColor="@color/COLOR_TXI_WHITE"
    android:textStyle="bold"/>
</LinearLayout>


../// OTHER ELEMENTS

</LinearLayout>

..///其他元素
..///其他元素

尝试从
文本输入文本中删除
android:layout\u marginEnd=“5dp”
属性
尝试从
文本输入文本中删除
android:layout\u marginEnd=“5dp”
属性这里只有一个简单的答案,只需删除文本输入文本背景,并提及它是

爪哇 android:background=“@android:color/transparent”


这里只是一个简单的答案,只需删除文本输入文本背景,并说明它是

爪哇 android:background=“@android:color/transparent”


请尽量提供你的答案的上下文。一个答案可以解决一个问题,但一个解释可以解决许多未来的问题。尽量包括您认为导致问题的原因以及您的答案能够解决问题的原因。@Newd android:layout_margined在视图边界之外的视图末尾指定额外的空间。我相信这是造成EditText和Button之间出现空格的原因。请尝试提供答案的上下文。一个答案可以解决一个问题,但一个解释可以解决许多未来的问题。尽量包括您认为导致问题的原因以及您的答案能够解决问题的原因。@Newd android:layout_margined在视图边界之外的视图末尾指定额外的空间。我相信,这会导致EditText和Button之间出现空格。