佈局調整需要一點點的工作,但可以做到的。首先,你需要創建一個自定義InAppMessageFragment:
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看如何-app消息片段的視圖通常被創建。