English 中文(简体)
简言之:如何获得清单,以调子
原标题:Android - how to get ListView to line up underneath Text View

我正试图在安的安普阿文附上一份名单。 然而,清单第一行显示的是与案文意见相同的一行。 我怎样才能这样做,才能在地下行动?

这里是:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    <TextView android:id="@+id/android:question"
          android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/dummy_question" />    
    <ListView android:id="@+id/android:list"
          android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    <TextView android:id="@+id/android:empty"
          android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/no_notes"/>

</LinearLayout>
最佳回答

问题只能是,根据线性原则:

<代码>android:orientation=vertical

问题回答

我看到两个问题。 首先,正如奇戈里提到的那样,你需要确定名单方向。 第二,一份清单不能对高点内容进行总结。 是什么样子? 两行? 基本上来说,一份清单没有说明你为何要这样做。 为此:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:orientation="vertical">

<TextView android:id="@+id/android:question"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/dummy_question" />    
<ListView android:id="@+id/android:list"
      android:layout_width="wrap_content"
        android:layout_height="0px" android:layout_weight="1" />
<TextView android:id="@+id/android:empty"
      android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_notes"/>
</LinearLayout>




相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签