图片ImageView
图片控件的xml写法
复制<ImageView
android:id="@+id/myImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="资源/1.png"
android:layout_centerInParent="true"/>
layout_width: 图片宽度可以填写具体数值像素值比如200,wrapcontent是自适应图片宽度
layout_height: 图片高度可以填写具体数值像素值比如200,wrapcontent是自适应图片宽度
src: 图片路径这里支持几种方式
本地路径: src=”sdcard/1.png”
**项目资源路径:**src=”资源/1.png”
**网址:src=”https://p1.ssl.qhimgs1.com/sdr/400 (opens new window)/t013a23e1f762939921.jpg”
base64:src=”data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAiVJREFUWEftVsFxwjAQ3DOFhBQASQchr5gqgEoIlWCqgLzidBCggCiF4MucbGwLSchWMpMP+sDY0t3e3t7KhH9e9M/5cQPQj4HtaI6E7sA0BIohIL+yWAGJArFCwd/AIMf0U3VpbxiAJCXMAJp0Cdjs4RyMTQiMH8DuYQ3w3J2Uc11xvYQNWZqR6n/rJOEVRbJxsWID0BXT0gzUrRqdcvs4QVI8gSHg22AUmFeYHrN2USaA3ejdpJoyMK269tNiS8AQz0wmpZjB4hyzBLB9HIJO6ya53iSJ83599+zWQIp1ixEFTp4FBFnJpV8vh5U3sbRIVj0N0vpa/aIL5WXsbbwE47WKrUEQ2g+ZF5c9qvtaUimTYIvMQqtbJ6KzGSzzVfrgvGyBPCySD+eBq9MQapDZ73r3WRvpfuEfQ5Ou6mw9DSbVoiFhxq1+4Epb3QB+Ow26wtPSmCiPF9gATMpFKDIycdNgeQplSPcLvw+cjUSPDCukx+fgNOgNA7/69YgX77pF5egZxbhbIBS6qg7eC5VGLtyunKTR3DVh4cvIaVSR6nccCwMoXUwobC3KDPPR6hePuLiMfL7SjhSqxTAq2CKyzhsiDu8PMyAZJKjP2VwVtIwmVGA3AKEov3gfD6A2G/kia67XvljiAezGX83FxPlVz7iCKg5AaS4CoFnpISpW1CGd1WAACunhvi/9sj8eQP25JRqI/2yLBxBTbpQT/lEiX5gbAz8CGhTbmaZIJQAAAABJRU5ErkJggg==”
# aiwork中案例
复制var ac= new activity();
ac.loadXML(`
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<ImageView
android:id="@+id/myImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="资源/1.png"
android:layout_centerInParent="true"></ImageView>
</LinearLayout>
`)