English 中文(简体)
如何用文字表达来填补甲型六氯环己烷的母体元素
原标题:How to make a edittext view fill the parent element in android
  • 时间:2012-05-12 22:04:33
  •  标签:
  • android
  • xml

I have two edittext views. One of them has only one line, its the title. But the other one should fill the linearlayout to the end, but it doesn t. I updated the code so this is my whole xml for this app. I hope someone can find what s wrong. The part that i want to form like this is the part inside the LinearLayout named addView.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
android:background="#ffffff">

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

    <Button 
        android:id="@+id/addButton"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:background="@drawable/addbuttonstyle"
        android:layout_weight="20"/>

    <ImageView
        android:id="@+id/titleView"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:background="@drawable/titleview"
        android:layout_weight="60"/>

    <Button 
        android:id="@+id/orderButton"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:background="@drawable/orderbuttonstyle"
        android:layout_weight="20"/>

</LinearLayout>  

<FrameLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
> 
    <LinearLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/addView"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

        <EditText 
            android:id="@+id/textBoxTitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="note title"
            android:singleLine="true"

            />
         <EditText 
            android:id="@+id/textBoxContent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:hint="content"
            />
    </LinearLayout>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@+id/backgroundLayout"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/background"
    />

</FrameLayout>

最佳回答

So i found what was wrong. I needed to set layout_height (of the textBoxContent view) to 0dp and layout_weight (of the textBoxContent view) to 1.

问题回答

页: 1

“Screen

你们是否希望这样做? 另外,如果你希望<代码>连续出现在左上角,则使用这一特性:

<EditText
    ...
    android:gravity="top"
    />

第一种观点应当有和roid:传承-width=“wrap_content”





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签