tencent cloud

Tencent Cloud Super App as a Service

Contrato
Contrato de segurança e processamento de dados
DocumentaçãoTencent Cloud Super App as a Service

Customizing Image Preview

Modo Foco
Tamanho da Fonte
Última atualização: 2025-07-04 17:33:28
The mini program SDK provides a default image preview implementation, which is triggered when the mini program calls wx.previewImage for multimedia selection.
Custom image preview can be achieved by overriding the openImagePreview method in BaseMiniAppProxyImpl class.
The default image preview page is shown as follows:

API description:
Parameter context: The Activity instance of the current mini program page.
Parameter selectedIndex: The position of the currently selected image in the list.
Parameter pathList: The list of image paths to be displayed.
Return value boolean: A return value of false indicates that the default image display is used, while a return value of true indicates that the custom image display is used.
/**
* Opens the image preview page
* Calling environment: Subprocess
*
* @param context - Current Activity
* @param selectedIndex - Index of the selected image
* @param pathList - Image path list
* @return - Returns false if this API is not supported
*/
public abstract boolean openImagePreview(Context context, int selectedIndex, List<String> pathList);
Example:
/**
* Opens the image preview page
*
* @param context - Current Activity
* @param selectedIndex - Index of the selected image
* @param pathList - Image path list
* @return - Returns false if this API is not supported
*/
@Override
public boolean openImagePreview(Context context, int selectedIndex, List<String> pathList) {
//todo start your image preview
Intent intent = new Intent(context, CustomPreviewActivity.class);
intent.putExtra("curIndex",selectedIndex);
intent.putStringArrayListExtra("pathList", pathList);
context.startActivity(intent);
return true;
}





Ajuda e Suporte

Esta página foi útil?

comentários