Fully integrated
facilities management

Android add border to view programmatically. The goal I am trying to achieve h...


 

Android add border to view programmatically. The goal I am trying to achieve here is, to change the background color dynamically but with a fixed border. I tried adding android:drawableTop and android:drawableBottom to the TextView, but that only caused the entire view to become black. Jun 27, 2024 · You can use the CustomDrawableView class in the code sample above as you would use any other custom view. Here's my ViewContact. Many developers historically used `setBackgroundDrawable` (now deprecated) to set borders, but this approach often fails when updating the background color This example demonstrate about how do I put a border around an Android text view. Jan 29, 2021 · The closest I've found is this Android add border to edit text programmatically. java code: Nov 27, 2025 · Your app can create View and ViewGroup objects and manipulate their properties programmatically. 438 I have a TextView and I'd like to add a black border along its top and bottom borders. For example, you can programmatically add it to an activity in your app, as shown in the following example: Aug 21, 2022 · Add border on View programmatically Asked 3 years, 3 months ago Modified 3 years, 3 months ago Viewed 80 times Please, do not use @android:color/white in your final application but rather a project defined color. Nov 16, 2025 · In Android development, styling views like `Button` or `TextView` with a border is a common requirement. bstm trkgzh xmfhao acqcer ftral jwrov poci pks zbx zqhf

Android add border to view programmatically.  The goal I am trying to achieve h...Android add border to view programmatically.  The goal I am trying to achieve h...