0

TextView と EditText を ScrollView に入れようとしていますが、表示されません。EditText を削除すると、TextView が表示されます。私は何が間違っているのか、それを修正するために何ができるのか疑問に思っています。ありがとう!

XML:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:hint="Enter List Name here"
            android:id="@+id/editText"
            android:paddingTop="50px"/>

    <ScrollView
            android:paddingTop="20px"
            android:layout_width="fill_parent"
            android:layout_height="285dp"
            android:id="@+id/scrollView"
            android:layout_gravity="center">

        <LinearLayout
        android:
        android:paddingTop="10px"
        android:layout_width="fill_parent"
        android:layout_height="40px"
        android:orientation="horizontal">

        <TextView
        android:layout_width="40px"
        android:layout_height="40px"
        android:text="1."
        android:id="@+id/textView2"/>
            <EditText
                    android:layout_width="40px"
                    android:layout_height="40px"
                    android:hint="Enter List Name here"
                    android:id="@+id/listitem1"
                    android:paddingTop="50px"/>

        </LinearLayout>
    </ScrollView>

</LinearLayout>
4

2 に答える 2

0

あなたは と をセットandroid:layout_height="40px"したので、がレイアウトされると、もう一方のスペースはありません。LinearLayoutEditTextTextViewTextView

を に変更してみてheightください。また、後者は推奨されていないため、代わりに使用することに慣れる必要があります。あなたのはコピー/貼り付けエラーだと思いますが、指摘したいと思いましたLinearLayoutmatch_parentmatch_parentfill_parentmatch_parentandroid:LinearLayout

だから、次のようなものを試してください

<LinearLayout
    android: <!-- something should be here...probably an id   -->
    android:paddingTop="10px"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <TextView
        android:layout_width="40px"
        android:layout_height="40px"
        android:text="1."
        android:id="@+id/textView2"/>
    <EditText
        android:layout_width="40px"
        android:layout_height="40px"
        android:hint="Enter List Name here"
        android:id="@+id/listitem1"
        android:paddingTop="50px"/>

</LinearLayout>
于 2013-06-12T22:52:54.933 に答える
0
    <EditText
                android:layout_width="40px"
                android:layout_height="40px"
                android:hint="Enter List Name here"
                android:id="@+id/listitem1"
                android:paddingTop="50px"/>

パディングがレイアウト サイズのサイズよりも大きい

ビューのパディングとマージンの違い

于 2013-06-12T22:57:16.093 に答える