Variable number of textedits in alertdialog in android? -
is possible set variable number of textedits in alertdialog? i've tried fill container views such stackview or linearlayout dynamically method addview said not supported in adapterview(exception). what's solution?
added:
want build alertdialog dynamic information.
alertdialog.builder alert = new alertdialog.builder(context);
now can set view this:
alert.setview(v);
but v element can simple textview or edittext. if want create container view may contain variable number of elements, example 2 textviews , 3 edittexts? how can this? create separate layout file , inflate view bit it's not solution. can do?
why need variable number of textview
s? use single 1 display multiple lines. if need more complicated, create own dialog-like activity theme @android:style/theme.dialog
, constraining dimensions not cover entire display area.
update:
here example of how dialog-like subactivity:
:: complexdialog.java
public class complexdialog extends activity { ...regular activity stuff... protected void oncreate(bundle savedinstancestate) { ...get extras intent, set layout, handle input, etc... linearlayout dialoglayout = (linearlayout) findviewbyid(r.id.dialoglayout); display display = getwindowmanager().getdefaultdisplay(); int width = display.getwidth() > 640 ? 640 : (int) (display.getwidth() * 0.80); dialoglayout.setminimumwidth(width); dialoglayout.invalidate(); ...more regular stuff... };
:: androidmanifest.xml
<activity android:name=".complexdialog" android:theme="@android:style/theme.dialog"></activity>
Comments
Post a Comment