FragmentActivity获取Fragment内控件的方法


public class MainActivity extends FragmentActivity { 

private TextView tv_city; 

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //获取Fragment里面的控件
        tv_city = (TextView)getFragmentManager().findFragmentById(R.id.btn_discount).getView().findViewById(R.id.tv_city);
       




你可能感兴趣的:(ANDROID)