在线直播系统源码,实现在图片上涂鸦并记录涂鸦轨迹
1.activity_main.xml界面
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="@+id/hw"
android:layout_width="300dp"
android:layout_height="500dp"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"></LinearLayout>
<TextView
android:id="@+id/txt_result"
android:layout_gravity="center"
android:layout_marginTop="@dimen/space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/txt_choose"
android:textColor="@color/black"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="100dp"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="@dimen/icon_loc"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/icon_lasso"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:background="@drawable/ic_lasso"></Button>
<TextView
android:id="@+id/txt_lasso"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space"
android:text="@string/txt_lasso"
android:textColor="@color/black"
android:textSize="@dimen/btn_txt_size"
></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/icon_loc"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/icon_pen"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:background="@drawable/ic_pen"></Button>
<TextView
android:id="@+id/txt_pen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space"
android:text="@string/txt_pen"
android:textColor="@color/black"
android:textSize="@dimen/btn_txt_size"
></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/icon_loc"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/icon_next"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:gravity="center"
android:background="@drawable/ic_next"></Button>
<TextView
android:id="@+id/txt_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/space"
android:text="@string/txt_next"
android:textColor="@color/black"
android:textSize="@dimen/btn_txt_size"
></TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
2.file_paths.xml图片存储路径
<?xml version="1.0" encoding="utf-8"?>
<resources>
<external-cache-path path="." name="take_photo"/>
</resources>
3.mainfest文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.buildmaterialapplication">
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_car"
android:label="@string/app_name"
android:roundIcon="@drawable/ic_car"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
android:hardwareAccelerated="false"
android:largeHeap="true">
<activity
android:name=".MainActivity"
android:exported="true"
tools:ignore="DuplicateActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:authorities="com.buildmaterialapplication.fileprovider"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>
</application>
<supports-screens android:resizeable="true" />
</manifest>
以上就是在线直播系统源码,实现在图片上涂鸦并记录涂鸦轨迹, 更多内容欢迎关注之后的文章
标签:涂鸦,layout,dimen,id,width,直播,android,height,源码 From: https://www.cnblogs.com/yunbaomengnan/p/17361958.html