레이아웃 조정은 조금 더 많은 일을하지만, 할 수 있습니다.
public class CustomInAppMessageFragment extends InAppMessageFragment {
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
if (getMessage() == null || getMessage().getAlert() == null) {
dismiss(false);
return null;
}
// Bind the in-app message to the layout. The fragment is attached to the content of the activity,
// so it has the full activity width and height to work with.
TextView view = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, container, false);
view.setText(getMessage().getAlert());
return view;
}
}
그런 다음 이륙 후 인 - 응용 프로그램 메시지 관리자의 조각 공장 설정 :
airship.getInAppMessageManager().setFragmentFactory(new InAppMessageFragmentFactory() {
@Override
public InAppMessageFragment createFragment(InAppMessage message) {
return new CustomInAppMessageFragment();
}
});
는 방법에를 볼 수 source에서 봐 먼저 사용자 정의 InAppMessageFragment을 만들어야합니다 -app 메시지 조각의보기가 정상적으로 작성됩니다.