1
충분한 시간을 보내지 못한 후 여기를 게시하여 도움을 요청합니다. 다음 FragmentActivity에서 호출 된 ListFragment 있습니다. 레이아웃에는 맨 위에 제출 버튼이있어서 사용자가 정보를 채우면 목록을 스크롤하고 제출 버튼을 누를 수 있습니다. 그러나이 제출 버튼을 클릭 할 수 없습니다. 그것은 결코 초점을 얻지 못합니다. 어떻게 해결할 수 있습니까?FragmentActivity의 버튼에 초점을 맞출 수 없음
도움 주셔서 감사합니다.
나는이 FragmentActivity이 : 여기
public class SurveyFragmentAnchor extends FragmentActivity {
Button submit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_survey_fragment);
setTitle("Feedback and Survey");
submit = (Button) findViewById(R.id.submit_button);
submit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.v("SURVEY", "Button pressed");
}
});
}
}
그리고는 레이아웃입니다 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="4dp" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#e5e5e5">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#ee000000" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:paddingBottom="10dp"
android:text="Rating (1-5) 5= Excellent, 4=Very good, 3=Good,\n2= Satisfactory, 1= Needs Improvement"
android:textColor="#FFF" />
<Button
android:background="@drawable/button_blue2"
android:textColor="#FFF"
android:id="@+id/submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/my_survey_fragment"
android:text="Submit" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:drawSelectorOnTop="false" >
</ListView>
</LinearLayout>
<fragment
android:name="com.survey.MySurvey"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="47dp"
android:id="@+id/my_survey_fragment">
</fragment>
[관련 답변 ] (http://stackoverflow.com/questions/8577463/fragments-onclick-method-in-fragment-element) – wesdfgfgd
당신이 참조한 대답에 따라, 왜 내가 조각 안에 Button 코드를 넣었는지, '제출'을위한 값을 얻습니다. 여전히 나는 그것을 클릭 할 수 없다. 문제는 버튼이 결코 클릭을 할 수 없도록 초점을 맞추지 않는다는 것입니다. – zeeshan
다른보기에 있어야합니다. – wesdfgfgd