의 화면을 따라 편집 텍스트 폭을 적용하려면 scrollView를 만들고 tableLayout을 포함합니다. tablelayout의 첫 번째 행은 Edittext입니다. 내가 일하기 위해 EDITTEXT보기 매개 변수 를 설정에도 불구하고 다음과 같이위의 레이아웃 파일에
android:layout_width="match_parent"
android:layout_height="wrap_content"
그것을 결코 오른쪽으로 왼쪽에서 화면을 따라 걸쳐 없습니다!
왼쪽부터 차례대로 화면을 따라 Edittext를 만드는 방법을 알려주십시오.
레이아웃
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<!-- scrollView can host only one direct parent-->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:id="@+id/tl1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow
android:id="@+id/tr0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/et0"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</TableRow>
<TableRow
android:id="@+id/tr1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_label_x1"
android:layout_weight="1">
<TextView
android:id="@+id/tv_label_x1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x1: "/>
<TextView
android:id="@+id/tv_x1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/tv_label_x1"
android:text="x1value" />
</RelativeLayout>
</TableRow>
</TableLayout>
</ScrollView>
</RelativeLayout>
불행히도 내가 가지고있는 하나입니다 원래의 레이아웃에 추가가 아마 때문에 – user2121
내 환경 작동 이상하게 (에뮬레이터, 안드로이드 6) – nshmura
작동하지 않습니다 Edittext보기 아래에 세 개의 tablerow가 있습니다. 그들은 다음과 같을 것이다. x1 : x1value x2 : x2value x3 : x3value – user2121