Moment For Technology

Android development, using XML drawable to make a border with the background image

Posted on Aug. 26, 2023, 4:09 a.m. by Matiu Bell-Gilbert
Category: The back-end Tag: The back-end

In Android development, when the border needs to be set, the background image is used to achieve it, and the code is as follows:

layer-list xmlns:android="http://schemas.android.com/apk/res/android"  ! - even the frame color value -   item   shape   solid android: color = "# CCCCCC" /   / shape   / item  ! item android:bottom="1dp" Android :left=" 1DP "Android :right=" 1DP" Android :top=" 1DP " ! shape solid Android :color="# FFFFFF "/ /shape /item /layer-listCopy the code

In this case, adjust the bottom part according to your actual needs and control the display of the top, bottom, left and right borders.

    android:bottom="1dp"
    android:left="1dp"
    android:right="1dp"
    android:top="1dp"
Copy the code
Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.