[英]I can't drag or drop anything to layout graphical interface in Android
我正在使用Eclipse。 我无法将任何东西拖放到xml文件的图形界面中。
每当我拖动按钮或文本视图之类的东西时,它只会显示该位置的虚线块并停留在该位置。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="88dp"
android:text="text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="120dp"
android:text="text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="160dp"
android:text="Type your secret password"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
我刚刚将您的代码复制并粘贴到了我在Eclipse上制作的RelativeLayout
文件中,看来工作正常。 您是否尝试过使用TextViews
的高度和宽度或将背景图像添加到按钮以尝试更轻松地定位它们? wrap_content
可能使其变得太小。 如果这是您第一次使用Android布局,我建议您改用LinearLayout
。 即使对于更有经验的程序员来说, RelativeLayout
也会很困难和困难。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.