Android how to make LinearLayout (or other views) clickable and focusable


Taha Körkem

like this

I want to set focusable and clickable mode for LinearLayout (as shown in the image above). what should I do?

Hernan Bruno

try this, it worked for me

<LinearLayout android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:clickable="true"
              android:focusable="true"
              android:background="?android:attr/selectableItemBackground">
</LinearLayout>

Related


Make a view cover all other views in android?

Faruk Sirinti: I want to add facebook-like emoji to my app. I use a library called emojilike-android. It works, but I can't see the whole part of the view. It's under a text view called desc. I tried BringToFront() but couldn't get it to work. How to make emoj

How to make LinearLayout clickable

Jay Damsania I have a linear layout like this <LinearLayout android:id="@+id/optionlist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/divider" android:orientation="vertical" > </LinearL

Make UILabel focusable and clickable (tvOS)

Panic I'm trying to implement a 6 line high description label and would like it to be focusable. Ideally this means extending the UILabel class to create custom components. I tried this by implementing canBecomeFocusedbut didUpdateFocusInContextmy UILabel does

Make UILabel focusable and clickable (tvOS)

Panic I'm trying to implement a 6 line high description label and would like it to be focusable. Ideally this means extending the UILabel class to create custom components. I tried this by implementing canBecomeFocusedbut didUpdateFocusInContextmy UILabel does

How to make an irregularly shaped component clickable? android

joseb I want to make a clickable component with this irregular shape, but I don't know how to do it, I've been searching for days but no solution. There should be text and images inside the component. Any suggestions? thanks Gabriele Mariotti Using the materia

How to make an irregularly shaped component clickable? android

joseb I want to make a clickable component with this irregular shape, but I don't know how to do it, I've been searching for days but no solution. There should be text and images inside the component. Any suggestions? thanks Gabriele Mariotti Using the materia

How to make an iframe with SVG "focusable"

Serhi I want to detect click on iframe. The suggested way to do it, is to capture the blur event on the parent window. However, when the user clicks on the svg in the iframe, it doesn't take focus and the root window doesn't lose focus. Is there a way to force

How to make LinearLayout clickable

Jay Damsania I have a linear layout like this <LinearLayout android:id="@+id/optionlist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/divider" android:orientation="vertical" > </LinearL

Android - How to make a button on a screen overlay clickable

attack I'm trying to implement a simple lockscreen with screen overlays. I added a button to the XML layout and the app successfully covers the screen, but the button doesn't seem to work. public WindowManager winManager; public RelativeLayout wrapperV

How to make EditText focusable in mvvmcross

Spyros Savvides I would like to know if there is a binding mechanism from the ViewModel property that provides focus (cursor blinking or something indicating that the TextEdit has focus) in a specific EditText that I select. Stewart This is a general Mvvm ques

Make all views in the activity clickable

learner To make all the views in the activity clickable, I did it implements OnClickListenerin the activity signature and the XML for each view it has android:clickable="true". However, clicking the view doesn't seem to work? Here is my listener: @Override

How to make a dynamic Linearlayout with five image views

Please Hi, I have been working on this for two days. Basically, I want to achieve this design (see the one circled in red): http://tinypic.com/r/dy52k0/8 I want my XML layout to be dynamic, it will grow or shrink no matter what the screen size of the mobile de

How to make LinearLayout clickable

Jay Damsania I have a linear layout like this <LinearLayout android:id="@+id/optionlist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/divider" android:orientation="vertical" > </LinearL

Android: How to make a string clickable

username I'm working on an android app, I have a string with different values that I get from html parsing using jsoup, I now have some player names in this string, I want to make all the player names individually On click, I need to show some stats for each p

Overlapping views in LinearLayout Android

enthusiasm Please help me how to get this kind of view in "Linear Layout". I tried android:layout_gravity="" android:layout_weight="" When clicked, I want the label to have a full view like the 1s label shown in the picture. enthusiasm Thanks, I have do

How to make clickable rows link to other pages

Austin Donley I have some working code, but can't figure out how to change it to do what I need. Currently, it's a table of clickable rows that link to the "authid" page, which corresponds to the authid value on the table. I need to do this so that it still li

Make a view cover all other views in android?

Faruk Sirinti: I want to add facebook-like emoji to my app. I use a library called emojilike-android. It works, but I can't see the whole part of the view. It's under a text view called desc. I tried BringToFront() but couldn't get it to work. How to make emoj

How to make an iframe with SVG "focusable"

Serhi I want to detect click on iframe. The suggested way to do it, is to capture the blur event on the parent window. However, when the user clicks on the svg in the iframe, it doesn't take focus and the root window doesn't lose focus. Is there a way to force

How to make LinearLayout clickable

Jay Damsania I have a linear layout like this <LinearLayout android:id="@+id/optionlist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/divider" android:orientation="vertical" > </LinearL

How to make EditText focusable in mvvmcross

Spyros Savvides I would like to know if there is a binding mechanism from the ViewModel property that provides focus (cursor blinking or something indicating that the TextEdit has focus) in a specific EditText that I select. Stewart This is a general Mvvm ques

Make all views in the activity clickable

learner To make all the views in the activity clickable, I did it implements OnClickListenerin the activity signature and the XML for each view it has android:clickable="true". However, clicking the view doesn't seem to work? Here is my listener: @Override

Android: How to make a string clickable

username I'm working on an android app, I have a string with different values that I get from html parsing using jsoup, I now have some player names in this string, I want to make all the player names individually On click, I need to show some stats for each p

Overlapping views in LinearLayout Android

enthusiasm Please help me how to get this kind of view in "Linear Layout". I tried android:layout_gravity="" android:layout_weight="" When clicked, I want the label to have a full view like the 1s label shown in the picture. enthusiasm Thanks, I have do

How to make clickable rows link to other pages

Austin Donley I have some working code, but can't figure out how to change it to do what I need. Currently, it's a table of clickable rows that link to the "authid" page, which corresponds to the authid value on the table. I need to do this so that it still li