java - Limit listview, and display letters only -
java - Limit listview, and display letters only -
i have listview displayed user, , figuring out ways create listview non-infinite, , limit 25 items. trying restrict user beingness able display number in edittext. have tried add together android:inputtype="text|textnosuggestions" , in list view has proven ineffective.
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/white_wallpaper" > <listview android:id="@+id/listmessages" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/divider" android:divider="@null" android:dividerheight="0dp" android:inputtype="text|textnosuggestions" android:padding="0dip" android:stackfrombottom="true" android:transcriptmode="alwaysscroll" tools:listitem="@layout/message_left" /> <relativelayout android:id="@+id/divider" android:layout_width="fill_parent" android:layout_height="1dip" android:background="@color/off_white" android:layout_above="@+id/relsendmessage" /> <relativelayout android:id="@+id/relsendmessage" android:layout_width="wrap_content" android:layout_height="48dp" android:background="#ddd" android:paddingleft="10dp" android:layout_alignparentbottom="true"> <edittext android:id="@+id/messagebodyfield" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignbottom="@+id/sendbutton" android:layout_aligntop="@+id/sendbutton" android:layout_marginbottom="-4dp" android:layout_marginright="10dp" android:inputtype="text|textnosuggestions" android:layout_toleftof="@+id/sendbutton" android:background="@android:color/white" android:hint="@string/message_elipses" android:textcolor="#000000" android:textcolorlink="#adefda" android:textsize="14sp" /> <button android:id="@+id/sendbutton" android:layout_width="72dp" android:layout_height="match_parent" android:layout_alignparentright="true" android:layout_margin="4dp" android:background="@drawable/button_send" /> </relativelayout> <button android:id="@+id/ischedule" android:layout_width="120dp" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:alpha="0.7" android:background="#c11b17" android:text="schedule" android:textcolor="#f2f2f2" android:textsize="20sp" android:textstyle="bold" android:typeface="serif" /> </relativelayout>
any suggestions appreciated.
update:
as far limiting listview items, have below code: below how listview displayed programmatically:
messageslist = (listview) findviewbyid(r.id.listmessages); messageadapter = new messageadapter(this);
would below work:
@override public int getcount() { messageslist.setadapter(messageadapter); homecoming 25; }
so handle edit text problem, can utilize this
<edittext ... android:digits="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" />
now above characters 1 can entered edittext. can alter keyboard type in android:inputtype
. additionally wanted limit number of entries in listview. in baseadapter method of code, alter this:
@override public int getcount() { homecoming 25; }
update:
well can create custom arrayadapter , modify getcount method there. getcount()
in different class altogether, want alter maximum 25 there , set list view adapter. may want take here more uses of arrayadapters.
java android android-layout android-activity android-listview
Comments
Post a Comment