开发者

android Why is my RelativeLayout not working

Beginner question here!

look at picture,

I want the butten-edittext-button to fill the width of the screen.

The space to type text is to small.

Any ides?

(been searching and testing for 3 hour)

android Why is my RelativeLayout not working

here is my xml

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical">
    <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/examplegallery" 
             android:layout_width="fill_parent"
             android:layout_height="wrap_content" />
   <RelativeLayout 
        android:id="@+id/InnerRelativeLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_a开发者_开发技巧lignParentBottom="true" >
        <Button 
            android:id="@+id/btnNewPen" 
            android:layout_toLeftOf="@+id/edittextaddtext" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Pen"
        />      
        <EditText 
            android:id="@+id/edittextaddtext"
            android:layout_width="wrap_content"
            android:layout_toLeftOf="@+id/btnsave"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:text=""
        />
        <Button 
            android:id="@+id/btnsave" 
            android:layout_alignParentRight="true" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="save"
        />
   </RelativeLayout>
</RelativeLayout>


Try this:

<Button 
        android:id="@+id/btnNewPen" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Pen"
    />      
    <EditText 
        android:id="@+id/edittextaddtext"
        android:layout_width="fill_parent"
        android:layout_toLeftOf="@+id/btnsave"
        android:layout_toRightOf="@+id/btnNewPen"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:text=""
    />

Leaving the rest as it is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜