I'm looking for a button just like this (transparent background and when clicked it becomes gray):Image of the component
Asked
Active
Viewed 58 times
-1
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 09 '22 at 12:59
-
I'm just looking for a button like in the picture. ``` ``` – Mordechay Sep 10 '22 at 19:58
2 Answers
1
Your question is not so clear, but here is how you can create custom or style Button

DiLDoST
- 335
- 3
- 12
0
I succeeded. The solution is:
xml(button_category_template):
<?xml version="1.0" encoding="utf-8"?>
<Button
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#000000"
android:textSize="20sp"
/>
java(MainActivity):
public class startActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
Button btn = (Button)getLayoutInflater().inflate(R.layout.button_category_template, null);
lnr = findViewById(R.id.layoutApp);
lnr.addView(btn);
}
}
It may be possible to do it in a simpler way, but in my project I used it this way.

Mordechay
- 21
- 5