小编Ale*_*elo的帖子

mPDF - 页脚仅在最后一页上有效

我在这里看到了其他类似的问题,但我无法解决我的问题.我的问题是:标题在所有页面中都正常工作,但页脚仅在最后一页显示.

<?
$mpdf = new mPDF(   '',    // mode - default ''
                '',    // format - A4, for example, default ''
                0,     // font size - default 0
                '',    // default font family
                15,    // margin_left
                15,    // margin right
                58,     // margin top
                60,    // margin bottom
                6,     // margin header
                0,     // margin footer
                'L' );  // L - landscape, P - portrait
$mpdf->SetDisplayMode('fullpage');

$cabecalho = '<div>header</div>'; 
$paragrafo = '<div>body</div>'; 
$stylesheet = "table{
                  width: 100%;
                  text-align:center;
                  border: 2px …
Run Code Online (Sandbox Code Playgroud)

php footer mpdf

9
推荐指数
1
解决办法
8712
查看次数

上传的图像会导致PDF库出错

我正在使用ckeditor来处理HTML文本.当我在其中粘贴图像时,ckeditor会上传图像.我使用了像pdf库的TCPDF和MPDF,我有两个不同的错误,每个库中有一个错误.

mPDF错误:IMAGE错误(SOURCE-IMAGE):解析使用GD库创建的临时文件图像对象解析PNG图像时出错

TCPDF错误:[图像]无法获得图像的大小:(SOURCE-IMAGE)

粘贴在ckeditor中时我上传图片的代码如下:

<?php
session_start();

class image{

    private $save_path = 'uploads/';
    private $image_string = '';
    private $image_name = '';
    private $image;
    private $response = array();

    public $loaded = false;

    public function __construct(){
        $this->response = array(
            'error' => 1,
            'message' => 'unknown error.'
        );

        $this->image_string = filter_input(INPUT_POST, 'image');


        $ext = substr($this->image_string,11,3);
        $randomLetters = $rand = substr(md5(microtime()),rand(0,26),6);
        $imgnumber = count(scandir($this->save_path));

        $this->image_name = "$imgnumber$randomLetters.$ext";

        if(!empty($this->image_name) && !empty($this->image_string)){
            $this->loaded = true;
        }
    }

    public function save(){
        if(!empty($this->image_name) && !empty($this->image_string)){ …
Run Code Online (Sandbox Code Playgroud)

php pdf-generation image ckeditor

5
推荐指数
1
解决办法
1327
查看次数

RecyclerView 在开始时闪烁数据使行不可见

在某些设备中,recyclerview 正在闪烁项目,之后仅从项目中出现。我无法调试它,因为在模拟器和我的手机中它不会发生。

有没有人经历过?

在此处输入图片说明

正确的做法是保留如下 img:

在此处输入图片说明

我正在创建 RecyclerView,如下所示,在 SubItemsActivity 中:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    subMainList = ArrayList()

    subMainList = db.listSubItems("AND id_main_item=$mainId")

    layoutManagerRecycler = LinearLayoutManager(this)
    subMainItemsRecycler.layoutManager = layoutManagerRecycler
    subMainItemsRecycler.addItemDecoration(DividerItemDecoration(this, 1))

    var subMainAdapter = SubMainAdapter(this, subMainList, this, activate)
    subMainAdapter.setHasStableIds(true)
    subMainItemsRecycler.adapter = subMainAdapter
}
Run Code Online (Sandbox Code Playgroud)

recyclerView 布局在这里:我有两个 ConstraintLayouts,main 是第一个,id 为“prioritize_edit”,另一个 id 为“prioritize_sub”的布局不会出现在图像示例中。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/prioritize_edit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/counter"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:textSize="17sp"
            android:textStyle="bold"
            android:textColor="@color/white"
            android:paddingStart="4dp"
            android:paddingEnd="2dp"
            android:paddingVertical="7.5dp"
            android:layout_marginTop="4dp"
            android:layout_marginBottom="1dp"
            android:background="#BFBFBF"
            android:layout_marginStart="8dp"
            android:gravity="center"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/arrows" …
Run Code Online (Sandbox Code Playgroud)

android kotlin android-recyclerview

4
推荐指数
1
解决办法
182
查看次数

错误类型 3 - 错误:活动类 MainActivity 不存在

我试图重新创建我的项目导致此错误的原因,在模拟器中错误已解决,但它保留在 android 设备上。据说我的 MainActivity 不存在。

我看到这个问题并尝试了所有答案,但都失败了。

Error while executing: am start -n "com.example.test/com.example.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.test/com.example.myapplication.MainActivity }
Error type 3
Error: Activity class {com.example.test/com.example.myapplication.MainActivity} does not exist.

Error while Launching activity
Run Code Online (Sandbox Code Playgroud)

这是我的 AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.example.myapplication.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" …
Run Code Online (Sandbox Code Playgroud)

android kotlin android-studio

1
推荐指数
1
解决办法
1413
查看次数