80,351
社区成员
发帖
与我相关
我的任务
分享
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null" />
</LinearLayout>
int strokeWidth = 1; // 1dp 边框宽度
int strokeColor = Color.parseColor("#2E3135");//边框颜色
GradientDrawable gd = new GradientDrawable();//创建drawable
gd.setStroke(strokeWidth, strokeColor);
findViewById(R.id.layout).setBackgroundDrawable(gd);