2016-06-14 7 views
-1

編集テキスト内に何百行ものテキストがありますが、編集テキストの高さはmatch_parentに設定されていますが、コードの数行しか表示されず、画面の残りの部分が空になります。テキストを自分の編集テキストに埋め込むにはどうしたらいいですか? enter image description here私の編集テキストにテキストを入力するには?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/LinearLayout1" 
android:layout_width="fill_parent" 
android:layout_height="match_parent" 
android:background="@drawable/vector" 
android:orientation="vertical" > 

<EditText 
    android:id="@+id/ed" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/button2" 
    android:layout_alignParentTop="true" 
    android:layout_margin="5dp" 
    android:background="#50dddddd" 
    android:gravity="top|left" 
    android:inputType="textMultiLine" 
    android:lines="5" 
    android:maxWidth="5.0dip" 
    android:minWidth="10.0dip" 
    android:scrollHorizontally="false" 
    android:textColor="#424242" 
    android:textStyle="bold" /> 

<Button 
    android:id="@+id/button3" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Write File to Application SandBox" 
    android:visibility="gone" /> 

<Button 
    android:id="@+id/button4" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Read File from Application SandBox" 
    android:visibility="gone" /> 

<Button 
    android:id="@+id/button2" 
    android:layout_width="wrap_content" 
    android:layout_height="40dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_margin="5dp" 
    android:background="@drawable/antivirus_btn2" 
    android:text=" READ " 
    android:textColor="@drawable/antivirus_btn_text2" /> 

<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="40dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="5dp" 
    android:background="@drawable/antivirus_btn3" 
    android:text=" SAVE " 
    android:textColor="@drawable/antivirus_btn_text3" /> 

+0

なぜリストビューではありませんか? –

+0

クリケット私はeclipseでgradleプロジェクトを走らせることができましたが、プロジェクトを走らせることができませんでした.3つのプラグインを試しました。今Google googleサービスとAndroidサポートライブラリを廃止しました。私はAndroidスタジオに移行していますが、どうすればサポートライブラリを追加してサービスライブラリを再生できますか? – abbie

+0

Googleサービスやサポートライブラリは廃止予定です。ちょうどEclipse ADT。それらの両方をGradleの依存関係として含めます。 [Playサービスのこのリンク](https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project) –

答えて

0

利用のLinearLayoutの代わりに、RelativeLayout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/LinearLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/vector" 
android:orientation="vertical" > 

<EditText 
    android:id="@+id/ed" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="8" 
    android:layout_margin="5dp" 
    android:background="#50dddddd" 
    android:gravity="top|left" 
    android:inputType="textMultiLine" 
    android:textColor="#424242" 
    android:textStyle="bold" /> 

<Button 
    android:id="@+id/button3" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1"; 
    android:text="Write File to Application SandBox" 
    android:visibility="gone" /> 

<Button 
    android:id="@+id/button4" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1"; 
    android:text="Read File from Application SandBox" 
    android:visibility="gone" /> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:orientation="horizontal" 
    android:layout_weight="1"> 

<Button 
    android:id="@+id/button2" 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="1"; 
    android:layout_margin="5dp" 
    android:background="@drawable/antivirus_btn2" 
    android:text=" READ " 
    android:textColor="@drawable/antivirus_btn_text2" /> 

<Button 
    android:id="@+id/button1" 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="1"; 
    android:layout_margin="5dp" 
    android:background="@drawable/antivirus_btn3" 
    android:text=" SAVE " 
    android:textColor="@drawable/antivirus_btn_text3" /> 
    </LinearLayout> 
    </LinearLayout> 
0

よく見るとあなたのEditTextの高さは、あなたが必要wrap_contentないmatch_parent

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/LinearLayout1" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/vector" 
android:orientation="vertical" > 

<EditText 
    android:id="@+id/ed" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 

ですmatch_parentまたはfill_parentに固定します。

関連する問題