如何摆脱按钮中的灰色空间?

时间:2018-03-07 15:44:56

标签: android android-drawable

Button with gray space Button with gray space 大家好,我很难搞清楚如何摆脱按钮内的灰色空间。我非常感谢你的帮助。

这是我的drawable和按钮的代码。

#descriptive features
size=[500,550,620,630,665,700,770,880,920,1000]
dummy=[1,1,1,1,1,1,1,1,1,1]

#Vector which contains the descriptive features
features=[dummy,size]


#target feature
rental_prize=[320,380,400,390,385,410,480,600,570,620]


#########Gradient decent Algorithm#############



#Set the learning rate alpha
alpha=0.00000002

#Feature weight vector --> model=[W0,W1]
#Set initail values for W0 and W1
model=[-0.146,0.185]


#Sum Squared Error
scatterSSE=[]



for j in range(100):

    #Squared Error
    SSE=np.sum([(rental_prize[x]-(model[0]*features[0][x]+model[1]*features[1][x]))**2 for x in range(len(rental_prize))])
    scatterSSE.append(SSE)

    for i in range(len(model)):       

        #Updating the weight factors w[i]
        errorDelta=np.sum([(rental_prize[x]-(model[0]*features[0][x]+model[1]*features[1][x]))*features[i][x] for x in range(len(rental_prize))])
        model[i]=model[i]+alpha*errorDelta





#Linear Equation after 100 itarations        
print("Linear Equation after 100 iterations:","HOUSE PRIZE={0}+{1}*SIZE".format(model[0],model[1]),sep="\n")




#########Plot the results######        

fig= plt.figure(figsize=(20,10))
ax = fig.add_subplot(131)
ax1 = fig.add_subplot(132)

#Plot the SSE 
y=list(range(1,101,1))
ax.scatter(y,scatterSSE)
ax.set_title("SSE")
ax.set_ylabel("SSE")
ax.set_xlabel("Iterations")


#Plot the linear regression
ax1.scatter(size,rental_prize)

X=list(np.linspace(min(size),max(size),100))
y=[model[0]+model[1]*x for x in X]
ax1.plot(X,y,"red")
ax1.set_title("Linear Regression")
ax1.set_ylabel("Prize")
ax1.set_xlabel("Size")




plt.show()

1 个答案:

答案 0 :(得分:0)

您可以使用这样的

简单地将颜色添加到drawable中的形状

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
  <solid android:color="@color/your_color" />
  <corners android:radius="100dp" />
  <stroke android:width="5px" android:color="@color/pink" />
</shape>