layout_weight
을 사용하여 EditText
필드 오른쪽에 단추를 표시하려고합니다. 내 디자인보기처럼 보일 수있는 컴파일 된 버전을 얻을 수있는 방법이LayoutWeights가 요소를 올바르게 조정하지 않음
있습니까 :
그러나,이 일이 무엇입니까? 여기
내 디자인보기입니다 그리고 여기 내 레이아웃 코드 :
<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_marginEnd="5dp"
속성을 제거하려고 시도합니다. 대답은 문제를 해결할 수 있지만 설명은 많은 미래의 문제를 해결할 수 있습니다. 문제의 원인이라고 생각하는 것을 포함시키고 답변으로 해결할 수있는 이유를 포함 시키십시오. – Newd@Newd android : layout_marginEnd는 뷰의 경계 밖에서 뷰 끝에 추가 공간을 지정합니다. 이것은 내가 생각하기에 EditText와 Button 사이에 공간이 생겨났습니다. – sats