我有一个表单,您可以在其中插入图像。我在虚拟内部的/* Compute q = (a - K) / (a + K) with improved accuracy. Variant 5 */
m = a - K;
p = a + K;
r = 1.0f / p;
q = m * r;
t = fmaf (q + 1.0f, -K, a);
e = fmaf (q, -a, t);
q = fmaf (r, e, q);
外面放了虚线。我还使用了一个图像适合imageview的类。现在,当我尝试在imageview中插入图像时,它可以成功插入图像,但虚线不会根据图像的大小进行调整。
imageview
class of image to fit inside the imageView
public class SquareImageView extends ImageView
{
public SquareImageView(Context context)
{
super(context);
}
public SquareImageView(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth()); //Snap to width
}
}
XML file for the stroke
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="2dp"
android:color="#cccccc"
android:dashWidth="10dp"
android:dashGap="6dp" />
<padding android:left="7dp" android:top="7dp"
android:right="7dp" android:bottom="7dp" />
<corners android:radius="2dp" />
</shape>
用于图片视图
content_main.xml
<junienegentien2015.android.ourthesis.com.detailsform.SquareImageView
android:id="@+id/container_with_dotted_border"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:background="@drawable/dotted_border"
android:src="@drawable/grm_upload"/>