shape画图(转)

在GradientDrawable1试图中终于把shape学会了,以前总是似懂非懂,现在终于把里面的东西搞清楚了,同时也挺佩服谷歌的用心,故意设置一些陷阱吧,不认真对待还真以为没有啥效果呢。 
setContentView(R.layout.shape_drawable_1) 
shape_drawable_1 代码如下: 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 

<LinearLayout 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 
android:src="@drawable/shape_1" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 
android:src="@drawable/line" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 
android:src="@drawable/shape_2" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:src="@drawable/line" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 
android:src="@drawable/shape_3" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="20dip" 
android:src="@drawable/line" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 
android:src="@drawable/shape_4" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:src="@drawable/line" /> 

<ImageView 
android:layout_width="fill_parent" 
android:layout_height="50dip" 

android:src="@drawable/shape_5" /> 

</LinearLayout> 
</ScrollView> 
shape_5的代码: 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
<gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" 
android:angle="270"/> 
<padding android:left="50dp" android:top="20dp" 
android:right="7dp" android:bottom="7dp" /> 
<corners android:radius="8dp" /> 

</shape> 
gradient  产生颜色渐变  android:angle 从哪个角度开始变 貌似只有90的整数倍可以 
android:shape="rectangle" 默认的也是长方形 

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> 
<solid android:color="#ff4100ff"/> 
<stroke android:width="2dp" android:color="#ee31ff5e" 
android:dashWidth="3dp" android:dashGap="2dp" /> 
<padding android:left="7dp" android:top="7dp" 
android:right="7dp" android:bottom="7dp" /> 
<corners android:radius="6dp" /> 
</shape> 

#ff4100ff蓝色#ff4100ff绿色 
<solid android:color="#ff4100ff"/>实心的 填充里面 
<stroke 描边 采用那样的方式将外形轮廓线画出来 

android:dashWidth="3dp" android:dashGap="2dp" 默认值为0 

android:width="2dp" android:color="#FF00ff00"笔的粗细, 
android:dashWidth="5dp" android:dashGap="5dp" 实现- - -这样的效果,dashWidth指的是一条小横线的宽度 
dashGap 指的是 小横线与小横线的间距。 width="2dp" 不能太宽

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
CovNeXt论文中的图主要包括两部分:Covolutional NeXt模块和CovNeXt网络结构。 Covolutional NeXt模块的图可以使用如下的代码进行绘制: ``` input_tensor = Input(shape=input_shape) x = input_tensor for i in range(nb_repeat): x = CovNeXtBlock(filters, kernel_size, cardinality, bottleneck_width, strides)(x) model = Model(inputs=input_tensor, outputs=x) ``` 其中,input_shape表示输入张量的形状,nb_repeat表示Covolutional NeXt模块需要重复的次数,filters表示卷积核的数量,kernel_size表示卷积核的大小,cardinality表示分组数量,bottleneck_width表示瓶颈层的宽度,strides表示卷积的步长。 CovNeXt网络结构的图可以使用如下的代码进行绘制: ``` input_tensor = Input(shape=input_shape) x = Conv2D(32, (3, 3), strides=(2, 2), padding='same')(input_tensor) x = BatchNormalization()(x) x = Activation('relu')(x) x = Conv2D(64, (3, 3), padding='same')(x) x = BatchNormalization()(x) x = Activation('relu')(x) x = MaxPooling2D((3, 3), strides=(2, 2), padding='same')(x) for i in range(len(filters)): x = CovNeXtBlock(filters[i], kernel_size[i], cardinality[i], bottleneck_width[i], strides[i])(x) x = GlobalAveragePooling2D()(x) x = Dense(nb_classes, activation='softmax')(x) model = Model(inputs=input_tensor, outputs=x) ``` 其中,input_shape表示输入张量的形状,filters、kernel_size、cardinality、bottleneck_width和strides分别表示Covolutional NeXt模块的参数,nb_classes表示分类数量。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值