[英]How can i add border to bottom of image?
我想在图像底部添加50px高的红色边框。
例如:
<ImageView android:id="@+id/meme_generated_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:scaleType="fitCenter" />
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<EditText android:id="@+id/edt_meme_bottom_txt1" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@drawable/edt_text_bg" android:ems="10"
android:hint="Write Text" android:padding="10dp" android:singleLine="true" />
</LinearLayout>
我的图像从Java文件加载。 你能帮我么。
使用下面的代码并将其添加到图片下方
<View android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="20dp(as per your requirment)"
android:background="your background color or boarder" />
更新在发布代码时,请在ml以下将您的xml替换为ml。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation = "vertical">
<ImageView android:id="@+id/meme_generated_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:scaleType="fitCenter" />
<View android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="20dp(as per your requirment)"
android:background="your background color or boarder" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<EditText android:id="@+id/edt_meme_bottom_txt1" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@drawable/edt_text_bg" android:ems="10"
android:hint="Write Text" android:padding="10dp" android:singleLine="true" />
</LinearLayout>
如果要在加载图像后在图像下方显示boader,请先使视图的可见性消失,然后在图像视图中完成图像加载后,再通过Java代码使该视图可见。
希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.