Android 为什么我的第二条直线没有显示出来?
我刚刚决定试用Android SDK,所以我安装了它,现在我正在尝试为我制作的计算器制作一个使用XML文件的简单界面,我可能会移植到Android 下面是我要使用的XML文件的初稿:Android 为什么我的第二条直线没有显示出来?,android,xml,user-interface,Android,Xml,User Interface,我刚刚决定试用Android SDK,所以我安装了它,现在我正在尝试为我制作的计算器制作一个使用XML文件的简单界面,我可能会移植到Android 下面是我要使用的XML文件的初稿: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="3"
android:text="To evaluate an expression, type it below."
/>
<EditText
android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/btnFunctions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Functions"
/>
<Button
android:id="@+id/btnConversions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Conversions"
/>
<Button
android:id="@+id/btnConstants"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Constants"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/btnGraphs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Graphs"
/>
<Button
android:id="@+id/btnStats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stats"
/>
</LinearLayout>
</LinearLayout>
但是,当我运行ant install
并在emulator上试用该应用程序时,最后(嵌套)线性布局中的最后两个按钮btnGraphs和btnStats根本不显示(其余的都可以)
我做错了什么?你应该用三个按钮将线性布局的布局高度更改为“环绕内容”,因为它正在填满屏幕,所以你看不到另一个线性布局。你应该用三个按钮将线性布局的布局高度更改为“环绕内容”它正在填充屏幕,因此您无法看到其他线性布局。您的第一个线性布局是:
android:layout_height="fill_parent"
更改为:
android:layout_height="wrap_content"
您的第一个线性布局是:
android:layout_height="fill_parent"
更改为:
android:layout_height="wrap_content"
第一个内嵌线性布局的布局高度设置为“填充父级”。这意味着它将占用屏幕上的所有空间,因此它下面的内容将不会被渲染。尝试将其更改为“包裹内容”,以仅占用所需的空间。第一个内嵌线性布局的布局高度设置为“填充父级”。这意味着它将占用屏幕上的所有空间,因此它下面的内容将不会被渲染。尝试将其更改为“包装内容”,以便只占用所需的空间