乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      android PreferenceScreen使用筆記

       jemeen 2012-03-30


      preference.xml

      1. <?xml version="1.0" encoding="utf-8"?>  
      2. <PreferenceScreen xmlns:android="http://schemas./apk/res/android"  
      3.     >  
      4.     <Preference android:title="基本信息"  
      5.         android:layout="@layout/text_view"></Preference> <!--自定義layout-->  
      6.     <CheckBoxPreference android:key="checkbox"  
      7.         android:title="性別"  
      8.         android:summary="男 ,女"/>  
      9.     <RingtonePreference android:key="ringtone"  
      10.         android:title="Ringtone Preference"  
      11.         android:showDefault="true"  
      12.         android:showSilent="true"  
      13.         android:summary="Pick a tone, any tone"/>   
      14. <ListPreference android:summary="select a list"  
      15.     android:title="Type"  
      16.     android:entries="@array/my_array" <!--string-array-->  
      17.     android:entryValues="@array/my_array"  
      18.     android:key="list"/>  
      19. <EditTextPreference android:key="edit"  
      20.     android:dialogTitle="nihao"  
      21.     android:title="姓名"  
      22.     />  
      23.   
      24. </PreferenceScreen>  

      **Activity.java

      1. package com.lin.share;  
      2.   
      3. import android.content.SharedPreferences;  
      4. import android.os.Bundle;  
      5. import android.preference.EditTextPreference;  
      6. import android.preference.ListPreference;  
      7. import android.preference.Preference;  
      8. import android.preference.Preference.OnPreferenceChangeListener;  
      9. import android.preference.PreferenceActivity;  
      10. import android.preference.PreferenceManager;  
      11. import android.view.View;  
      12.   
      13. public class TestPreferenctScreenActivity extends PreferenceActivity {  
      14.     /** Called when the activity is first created. */  
      15.     ListPreference  list;  
      16.     SharedPreferences prefs;  
      17.     EditTextPreference editTextPreference;  
      18.       
      19.     @Override  
      20.     public void onCreate(Bundle savedInstanceState) {  
      21.         super.onCreate(savedInstanceState);  
      22.         addPreferencesFromResource(R.xml.preference);  
      23.        prefs=PreferenceManager.getDefaultSharedPreferences(this);  
      24.         list=(ListPreference)findPreference("list");  
      25.         editTextPreference=(EditTextPreference)findPreference("edit");  
      26.         editTextPreference.setSummary(prefs.getString("edit","default"));  
      27.           
      28.         editTextPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {  
      29.               
      30.             @Override  
      31.             public boolean onPreferenceChange(Preference preference, Object newValue) {  
      32.                 // TODO Auto-generated method stub   
      33.                 editTextPreference.setSummary(newValue.toString());  
      34.                 editTextPreference.setDefaultValue(newValue);  
      35.                 editTextPreference.setText(newValue.toString());  
      36.                 return false;  
      37.             }  
      38.         });  
      39.         list.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {  
      40.               
      41.             @Override  
      42.             public boolean onPreferenceChange(Preference preference, Object newValue) {  
      43.                 System.out.println("change"+newValue);  
      44.                 list.setSummary(newValue.toString());  
      45.                 list.setValue(newValue.toString());  
      46.                 return false;  
      47.             }  
      48.         });  
      49.     }  
      50.   
      51.       
      52. }  

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶(hù) 評(píng)論公約

        類(lèi)似文章 更多