views:

494

answers:

3

A simple ListView with, say, 6 rows (Views). Now, I want it to fit exactly a single screen. Any straightforward way to do this? Or should I go with a custom view?

A: 

Don't think there is an straightforward way for this.

Define your own adapter class and then you'll have to resize the text size and other parameters for the TextViews that appear in your ListView so as to just fit within your screen.

Prashast
A: 

Hi,

There is no straight forward way to do it. The best possible way is to enclise your listview in a div and add overflow to it. This would make it apper, that the list is in a iframe. See this -->

style type="text/css">
<!--
div.scroll {
height: 200px;
width: 300px;
overflow: auto;
border: 1px solid #666;
background-color: #ccc;
padding: 8px;
}
-->
</style> 


<div class="scroll">
<asp:ListView id="ListView1"...../>
</div>

See this --> http://www.domedia.org/oveklykken/css-div-scroll.php

Bhaskar
A: 

Gone with a custom View.

Couple of snippets: PreferenceCategory-like TextView:

<TextView style="?android:attr/listSeparatorTextViewStyle"/>

ListView separators:

<ImageView android:src="?android:attr/listDivider"android:layout_height="1dp" android:layout_width="fill_parent"/>
alex