EditText doesn't fill the whole height of the window
EditText doesn't fill the whole height of the window. Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button android:id="@+id/bItalic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></Button>
<Button android:id="@+id/bBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button android:id="@+id/bUnderline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button android:id="@+id/bStrike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="S"
/>
<Button android:id="@+id/bSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button android:id="@+id/bSup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageButton
android:id="@+id/bInsertImage"
android:src="@drawable/insertimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageButton
android:id="@+id/bInsertTable"
android:src="@drawable/table"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<FrameLayout
android:id="@+id/FrameLayout02"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<TabHost android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="62px">
<ScrollView
android:id="@+id/scroll01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:id="@+id/scroll_hor01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/VisualPane"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</HorizontalScrollView>
</ScrollView>
<Sc开发者_如何学CrollView
android:id="@+id/scroll02"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:id="@+id/scroll_hor02"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/HTMLPane"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</HorizontalScrollView>
</ScrollView>
</FrameLayout>
</TabHost>
</FrameLayout>
</LinearLayout>
Here is a screenshot:
Why doesn't EditText fill the whole height of the window?
The width of HorizontalScrollView is the maximum width of its elements, so you can't use fill parent inside there, because the parent's width is undefined, hence it will be 0. What you are looking for - i think - is the android:scrollHorizontally attribute of EditText. Vertically it's scrollable by default (if it's size exceeds the display), so you shouldn't place it inside any ScrollViews. Simply use an EditText with fill parent dimensions, and with scrollHorizontally="true". Also make sure that the LinearLayout containing it also has fill parent height.
The parent LinearLayout property
android:layout_height="wrap_content"
must be
android:layout_height="fill_parent"
You can set the following property of the EditText
view
android:layout_margin="1dip"
This is a bit of a hack but will work for now.
Setting following properties helped me to change the size:
android:minHeight="105px"
android:layout_height="115px"
android:layout_width="250px"
精彩评论