Android - 布局错误

时间:2012-02-25 16:11:52

标签: android xml layout

我正在尝试创建一个按钮。我以前做过这样的事情,但现在我收到了一个错误,我找不到它是什么。我想我在xml文件中遇到了问题,但找不到它:S

所以有我的XML:

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

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

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ImageButton
        android:id="@+id/login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="115dp"
        android:layout_marginTop="80dp"
        android:src="@drawable/login_button" />
</RelativeLayout>

我正在尝试实现某种Facebook登录。我正在使用easyfacebook sdk。所以这是我试图实现登录按钮的java代码:

http://pastebin.com/brHmJKs1

我收到的消息如下:

W / webcore(29941):在第一个布局

之后无法获取viewWidth

E / SkLayout_wtle(29941):布局错误:106宽度:0 ellipsizedWidth:0

W / InputManagerService(1171):窗口已经聚焦,忽略焦点增益:com.android.internal.view.IInputMethodClient$Stub$Proxy@405c4e68

1 个答案:

答案 0 :(得分:1)

首先在最后一行关闭你的第一个LinearLayout。其次删除RelativeLayout,这是没用的,然后尝试我希望你会成功。