1

EditText が単一行に固定され、常に表示されるように、ヘッダー、リスト、および EditText をフォーマットするにはどうすればよいですか? これは、リスト エントリが 1 つだけの私のレイアウトです。 ここに画像の説明を入力

以下は、いくつかのリスト エントリを含むレイアウトです。入力中のテキストはソフト キーボードによって非表示になります。私はウェインと入力していました。 ここに画像の説明を入力

さまざまな Linear および Relative レイアウトを試しました。これが私の現在のレイアウトです:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<TextView
    android:id="@+id/select_child_header"
    style="@style/headerStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:background="@color/start_blue"
    android:text="Which child did you take a picture of?" />

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/modchild_fragment"
    android:name="com.chex.control.ChildList"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/select_child_header"
    android:focusable="true"
    android:focusableInTouchMode="true" >
</fragment>

<EditText
    android:id="@+id/new_child"
    style="@style/editTextStyle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
       android:layout_below="@id/modchild_fragment" 
    android:hint="new child name"
    android:inputType="text"
    android:singleLine="true" />

</RelativeLayout>

この画面をフォーマットする方法についてアドバイスをいただければ幸いです。

4

6 に答える 6

3

android:singleLine="true"これには2つのオプションがあります.1つはテキストビューで、このようにするとテキストが1行になり、一部のテキストが欠落していくつかのドットが表示される場合に呼び出されるタグがあります..

もう1つの方法は、このタグを使用してフォントサイズを小さくすることです..android:textSize="3sp"

于 2013-09-24T11:16:01.227 に答える
0

追加

 android:maxLines="1"

EditText に、目的の行数を取得します。

于 2013-09-24T11:17:42.467 に答える
0

この方法を試してください

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/select_child_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="Which child did you take a picture of?" />

    <fragment
        android:id="@+id/modchild_fragment"
        android:name="com.chex.control.ChildList"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:focusable="true"
        android:focusableInTouchMode="true" >
    </fragment>

    <EditText
        android:id="@+id/new_child"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_below="@id/modchild_fragment"
        android:hint="new child name"
        android:inputType="text"
        android:singleLine="true" />

</LinearLayout>
于 2013-09-24T11:22:29.353 に答える
0

設定

android:ellipsize=end  
android:singleLine="true"
于 2013-09-24T11:24:09.130 に答える
0

フラグメントに静的な高さを設定できます。たとえば、リスト項目が 1 つまたは 5 つ以上の場合、編集テキストはフラグメントの最下層を構成します。また、android:singleLine="true" プロパティを edittext に設定することもできます。

于 2013-09-24T11:28:43.733 に答える
0

要素の順序と配置を変更します。

  1. 最初にヘッダーを上に追加します
  2. 一番下の編集テキストを追加
  3. 間にフラグメントを追加します

何かのようなもの:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/select_child_header"
        style="@style/headerStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@color/start_blue"
        android:text="Which child did you take a picture of?" />

    <EditText
        android:id="@+id/new_child"
        style="@style/editTextStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:hint="new child name"
        android:inputType="text"
        android:singleLine="true" />

    <fragment
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/modchild_fragment"
        android:name="com.chex.control.ChildList"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/new_child"
        android:layout_below="@id/select_child_header"
        android:focusable="true"
        android:focusableInTouchMode="true" >
    </fragment>

</RelativeLayout>
于 2013-09-24T11:24:43.783 に答える