Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Custom android preference type loses focus when typing -


i created simple preference class shows autocompletetextview control , displays when focus on autocompletetextview , start typing brings keyboard loses focus on control.

any idea why loses focus?

here's did create view. inflated layout basic linear layout title textview in it.

i change dialog preference instead guess it'd smoother if part of base view.

@override protected view oncreateview(viewgroup parent) {     layoutinflater inflater = (layoutinflater) getcontext().getsystemservice(context.layout_inflater_service);     linearlayout layout = (linearlayout) inflater.inflate(r.layout.base_preference, null);      if (mhint != null) {         textview hintview = (textview) layout.findviewbyid(r.id.preferencehinttextview);         hintview.settext(mhint);     }      textview titleview = (textview) layout.findviewbyid(r.id.preferencetitletextview);     titleview.settext(gettitle());      autocompletetextview inputview = new autocompletetextview(getcontext());     inputview.setgravity(gravity.fill_horizontal);      arrayadapter<charsequence> adapter = new arrayadapter<charsequence>(getcontext(),             r.layout.auto_complete_text_list_item,             getentries());      inputview.setadapter(adapter);     inputview.setthreshold(1);     inputview.setonitemselectedlistener(this);     layout.addview(inputview);      return layout; } 

the list item is:

<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:padding="10dp"     android:textsize="16sp"     android:textcolor="#000"> </textview> 

could've been standard list item , come out identical.

i spent bit of time trying re-create issue you:

couple of questions:

  1. what getcontext() / getting context from?
  2. can show r.layout.auto_complete_text_list_item? standard list item worked me
  3. can show getentries() method? after testing small string[] array, worked me.
  4. setonitemselectedlistener(this) - can show method you're using implements onitemselectedlistener - might need requestfocus() here or doing odd pull focus away control... although selected , not click. i'm not sure if firing auto-select list (i.e. defaulting first item

lastly, try setting component xml , not doing dynamically test. first factor tried control. know you'll want dynamic it's not bad thing create custom autocompletetextview control uses own layout.

hope these help! project me review , assist.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -