[英]I can't drag or drop anything to layout graphical interface in Android
I am using Eclipse. 我正在使用Eclipse。 I can't Drag or Drop anything into graphical interface of my xml file.
我无法将任何东西拖放到xml文件的图形界面中。
When ever I drag anything like a button or a text view it just shows that position dotted block and just stuck at there. 每当我拖动按钮或文本视图之类的东西时,它只会显示该位置的虚线块并停留在该位置。
<?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>
I just copied and pasted your code into a RelativeLayout
file I just made on Eclipse, and it seems to be working fine. 我刚刚将您的代码复制并粘贴到了我在Eclipse上制作的
RelativeLayout
文件中,看来工作正常。 Have you tried maybe playing around with the height and width of the TextViews
or adding background images to the buttons to try and locate them easier? 您是否尝试过使用
TextViews
的高度和宽度或将背景图像添加到按钮以尝试更轻松地定位它们? It is possible the wrap_content
may be making it too small. wrap_content
可能使其变得太小。 And if this is your first time using Android layouts, I would recommend using LinearLayout
instead. 如果这是您第一次使用Android布局,我建议您改用
LinearLayout
。 RelativeLayout
can be tough and hard to work with, even for more experienced programmers. 即使对于更有经验的程序员来说,
RelativeLayout
也会很困难和困难。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.