Dynamic created Settings get small Dialogs

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Dynamic created Settings get small Dialogs

Postby falstaff » Fri Jan 09, 2009 12:40 pm

Hello,

I made Wi-Fi specific Host settings. Therefor I create EditTextPreference elements dynamical:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 EditTextPreference prefHost = new EditTextPreference(this);
  2.                 prefHost.setTitle(R.string.host);
  3.                 prefHost.setSummary(R.string.hostDescription);
  4.                 prefHost.setDefaultValue("");
  5.                 prefHost.setKey(keyPrefix+"host");
  6.                 toCategory.addPreference(prefHost);
  7.                
  8.                 EditTextPreference prefPort = new EditTextPreference(this);
  9.                 prefPort.setTitle(R.string.port);
  10.                 prefPort.setSummary(R.string.portDescription);
  11.                 prefPort.setDefaultValue("6600");
  12.                 prefPort.setKey(keyPrefix+"port");
  13.                 toCategory.addPreference(prefPort);
  14.                
  15.                 EditTextPreference prefPassword = new EditTextPreference(this);
  16.                 prefPassword.setTitle(R.string.password);
  17.                 prefPassword.setSummary(R.string.passwordDescription);
  18.                 prefPassword.setDefaultValue("");
  19.                 prefPassword.setKey(keyPrefix+"password");
  20.                 toCategory.addPreference(prefPassword);
  21.                
Parsed in 0.033 seconds, using GeSHi 1.0.8.4

This works fine, but now, when I click on a such EditTextPreference, all is very small :shock: :

Image

If I use an XML-File to load the Settings, the dialog is much bigger in size:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.                 <EditTextPreference  
  2.                    android:key="hostname"  
  3.                    android:title="@string/host"  
  4.                    android:summary="@string/hostDescription"
  5.                    />  
  6.             <EditTextPreference  
  7.                    android:key="port"
  8.                    android:title="@string/port"
  9.                    android:defaultValue="6600"
  10.                    android:summary="@string/portDescription"
  11.                    />  
  12.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Image

What can I do that the generated Dialog is in this size too? I belive the EditTextPreference doesnt know where it is attached and doesnt know how big he can draw its dialog... Is there a "repack" method or something like that? Thanks for any suggestion!

Bye
falstaff
Attachments
preference-problem2.png
preference-problem2.png (19.48 KiB) Viewed 364 times
preference-problem1.png
preference-problem1.png (14.3 KiB) Viewed 364 times
falstaff
Freshman
Freshman
 
Posts: 3
Joined: Fri Jan 09, 2009 12:30 pm

Top

Postby pjq » Fri May 22, 2009 4:13 am

You should set the dialog title like this
edit.setDialogTitle("Test");
Then it will show the right size.
pjq
Freshman
Freshman
 
Posts: 7
Joined: Fri May 15, 2009 1:36 am

Postby falstaff » Thu Jul 09, 2009 7:15 pm

Hi,

Thanks this worked like a charm!

Bye
falstaff
falstaff
Freshman
Freshman
 
Posts: 3
Joined: Fri Jan 09, 2009 12:30 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests