您好,我已设法通过将 XML 文件扩展为片段将它们绑定到 ViewPagerIndicator,但我无法使用基本的 findViewById 代码将我的按钮引用到代码中。这是我的代码,因为有人可以帮忙
package com.example.sliding;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class twoey extends Fragment {
Button lol;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View v = inflater.inflate(R.layout.two, null);
return v;
lol = (Button) findViewById (R.id.button1);
}
}
但是,无论我尝试做什么,我都无法得到findViewById字的红色小线,有人可以帮忙吗?