[英]Showing CustomViews properly in Graphical Layout of android xml
[英]My .xml files layout is not showing properly in simulation
在这种情况下,我的xml文件显示了某种布局,而在运行时生成了另一种布局。 我对为什么运行时显示的布局与给定的布局完全不同感到困惑。 这是xml文件的代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
</LinearLayout>
<Button
android:id="@+id/signUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign up!" />
</LinearLayout>
这将在标签和按钮上都在此处显示插入名称。 该按钮已正确绑定,按下它会执行某些操作,但是我无法在运行时在文本字段中键入。
这个看起来不错。 仔细检查您是否正在使用Java代码更改任何属性。
尝试改用这个。 我已经删除了无用的LinearLayout,并尝试使EditText可单击。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/signUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign up!" />
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.