我想在图像底部添加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代码使该视图可见。
希望对您有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句