2
사용자가 FrameLayout에서 렌더링 된 버튼을 클릭하면 새로운 액티비티를 시작해야합니다. 사용자가 원하는 버튼을 렌더링하지만, 당장은 아무 것도하지 않습니다.FrameLayout에서 액티비티 시작하기
클래스의 코드는 다음과 같지만 startActivity (intent)를 호출 할 수 없습니다.
public class TopBarView extends FrameLayout {
private ImageView mLogoImage;
private Button mInfoButton;
public TopBarView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TopBarView(Context context) {
super(context);
init();
}
public TopBarView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.top_bar, null);
mLogoImage = (ImageView) view.findViewById(R.id.imageLogo);
mInfoButton = (Button) view.findViewById(R.id.infoButton);
mInfoButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// We load & render the view for the information screen
// Intent i = new Intent();
// i.setClass(getContext(), MeerActivity.class);
// startActivity(i);
}
});
addView(view);
}
}
미리 감사드립니다.
도움에 대해 감사드립니다. – noloman