0

버튼을 선호 항목 Screeen activtiy에 추가 할 수 있습니다. 나는이 질문을 읽었다. How to add a button to PreferenceScreen 그리고 그것은 완벽하게 작동한다. 하지만 내 사용자 정의 타이틀을 추가하려면 응용 프로그램이 충돌합니다. 맞춤형 기능은 자체 활동에서 완벽하게 작동하며 단추가있는 환경 설정 화면은 자체 활동에서 완벽하게 작동합니다. 그래서 내 문제는이 두 기능을 함께 사용하는 데 기반을두고 있습니다. 자바 파일사용자 정의 창 제목이있는 활동에 Prefrences 화면 추가

public class TestHeadlineActivity extends PreferenceActivity implements OnClickListener{ 
    /** Called when the activity is first created. */ 
Button settingsButton; 
TextView tv_WindowTitleAccuracy; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
     addPreferencesFromResource(R.xml.prefs); 
     setContentView(R.layout.main); 
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title); 
     settingsButton = (Button) findViewById(R.id.Button_Settings); 
     settingsButton.setText("BUTTONTEXT"); 
    settingsButton.setOnClickListener(this); 
    tv_WindowTitleAccuracy = (TextView) findViewById(R.id.tv_WindowTitleAccuracy); 
    tv_WindowTitleAccuracy.setText("TEXT"); 

    } 

@Override 
public void onClick(View v) { 

    finish(); 

     } 
     } 

의에서

을 heres 내 코드이없는 내 주요 XML

을 heres
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical"> 
<ListView android:id="@android:id/list" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" android:layout_weight="10"/> 
<Button android:text="This is a button on top of all preferences." 
      android:layout_height="wrap_content" 
      android:layout_weight="1" android:layout_width="fill_parent"/> 
</LinearLayout> 

내 환경 설정이

<?xml version="1.0" encoding="utf-8"?> 
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> 

<EditTextPreference 
    android:title="EditText" 
    android:key="name" 
    android:summary="Enter your name" 
    ></EditTextPreference> 

    <CheckBoxPreference 
    android:title="Music" 
    android:defaultValue="true" 
    android:key="checkbox" 
    android:summary="for the splash screen" 
    /> 
    </PreferenceScreen> 

들 덕분에 여전히

답변