0
我用的片段,setOnClickListener - 不叫,我不明白什麼是錯setOnClickListener - 不叫
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View myFragmentView = inflater.inflate(R.layout.right_panel_1, container, true);
Button buttonStart = (Button) myFragmentView.findViewById(R.id.ButtonStart);
Button buttonFinish = (Button)myFragmentView.findViewById(R.id.buttonFinish);
buttonStart.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
////
}
});
buttonFinish.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
////
}
});
和佈局right_panel_1.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/ButtonStart"
android:layout_width="158dp"
android:layout_height="72dp"
android:gravity="center_vertical|center_horizontal"
android:text="Start"
android:textSize="@dimen/padding_large" />
<Button
android:id="@+id/buttonFinish"
android:layout_width="match_parent"
android:layout_height="72dp"
android:gravity="center_vertical|center_horizontal"
android:text="Finish"
android:textSize="@dimen/padding_large" />
</LinearLayout>
<ScrollView
android:id="@+id/scrollViewLog"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/myLog"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
@覆蓋並不重要在這裏,我也看過了,不僅如此, –
你可以添加課程的其餘部分嗎?更容易發現它然後:) –
我看通過示例http://neilgoodman.net/2012/03/12working-with-fragments-on-android-part-2/和創建和差異...它使用FragmentActivity,但我使用活動 –