Questions tagged [android-view]

Questions regarding Views in Android. Views may be defined in Android Layout XML or in Java code. Questions using this tag involve general View practices or advice. With regard to specific Views, refer to the info for this tag. For questions regarding layout, use the [android-layout] tag.

Introduction

A View in Android is the display of the data utilized by the application. Views range widely from simple and non-interactive to complex and interactive in many ways. In addition to the Views provided by the SDK, developers have the option to create custom Views. This means that virtually any communication or display to the user may be handled in innumerable ways.

ViewGroups

ViewGroup is a subclass of View, which has the ability to hold other Views. Children Views may be added to the ViewGroup at run-time (in Java code) or may be pre-defined in Android XML. Like Views, ViewGroups may also be extended in the same way. Follow these guidelines for questions regarding ViewGroups:

  • If the ViewGroup is provided by the Android SDK, it should be listed below in Standard Views.
  • If the ViewGroup is a Custom View, use

Standard Views

A wide variety of Views are delivered with the Android SDK for use by developers. These views make up a majority of the Views in a standard application. Each View has its own semantics and behaviors. As a result, it is often more beneficial to use the tags specifically related to those Views. Below is a list of standard views provide within the Android SDK:

Usage: vs.

While Views and layouts work hand-in-hand, questions regarding the two are often very different. These guidelines will help to properly determine which tag to use:

  • If the question refers to the properties used to display the View properly, then use .
  • If, instead, the question refers to the functionality of the View, then is appropriate.
3981 questions
1
vote
1 answer

Is there a way to set a custom view's size for a Scene with a percentage of the screen's size?

My goal is to set a custom Transition between two Scenes objects. The problem is that my ending scene contains a view that should have a specific width (80% of the screen width). I am aware about the layout_weight for children of LinearLayout for…
Tom3652
  • 2,540
  • 3
  • 19
  • 45
1
vote
1 answer

Possible to get reference to a View without setting the ContentView of an Activity

I want to be able to get reference to a RelativeLayout in the same way as RelativeLayout relative = (RelativeLayout)findViewById(R.id.relative); but without setting the ContentView of the Activity. I think it may have something to do with Infalter?…
1
vote
1 answer

OnClickListener won't work in some places of RecyclerView

I put another RecyclerView B in a RecyclerView A. I set an OnClickListener into the ItemView in the Adapter of the outer RecyclerView A. When I click anywhere on the ItemView in RecyclerView A, OnClickListener will work well but when I click…
1
vote
2 answers

How to create a View extension function in Kotlin

I'm trying to create an extension function in Kotlin. I did try several tutorials, but didn't quite understand, how to implement this one. I'm trying to create a setWidth() function as such //Find my_view in the fragment val myView =…
1
vote
0 answers

How to use a vertical seekbar view?

android:id="@+id/gradientSeekBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="8" android:progress="1" android:rotation="270" android:thumb="@drawable/thumb" android:thumbOffset="0dp" app:theme="@style/AppThem…
1
vote
0 answers

Espresso typeText() vs editText.setKeyListener(DigitsKeyListener.getInstance(null, false, true));

To help EditText reject keystrokes that are not a valid number, you set a DigitsKeyListener like this: myEditText.setKeyListener(DigitsKeyListener.getInstance(null, false, true)); That works under manual test - you can type 42.., and the keystroke…
Phlip
  • 5,253
  • 5
  • 32
  • 48
1
vote
2 answers

colors.xml and multiple module

I have 3 modules (common, app1, app2) in the common module I've a layout that I want to be black in app1 and white in app2. Layout.xml
Biscuit
  • 4,840
  • 4
  • 26
  • 54
1
vote
0 answers

How to get background and foreground pixels of view in android

I have two questions one related to background and other for foreground 1: I am trying of get background covered pixels of view for example as shown in picture with respect of view2 I want to get its background covered pixels…
1
vote
1 answer

How to add padding before CheckBox/RadioButton across API levels

I want to add padding to the left/start of RadioButton and CheckBox views. The motivation for this is to have full width selectable lists (for select one and select multiple) where the radio button or check box element have space between themselves…
seadowg
  • 147
  • 8
1
vote
2 answers

Databind error trying to include an android layout from standard library

In my XML file I wanted to include a layout from the standard library: But the Databinding library don't seems to like it: android.databinding.tool.processing.ScopedException: [databinding]…
1
vote
1 answer

Align horizontal RecyclerView items to borders

I want my RecyclerView items align to screen borders, android:layout_width="match_parent" isn't working and it's giving me this result: While this is what I'm trying to achieve: Any help would be appreciated.
1
vote
1 answer

Cannot call removeOnDrawListener inside of onDraw

I'm writing a code to save a bitmap from the app's screen at a specific moment. I'm doing this by listening to onDraw() events for some component and checking if a set of conditions is true @Override public void onDraw() { if…
Rafael Lima
  • 3,079
  • 3
  • 41
  • 105
1
vote
2 answers

RecyclerView vs LinearLayout when displaying very large chunks of text

If I have a recycler view that has a few cards and some of the cards are basically a TextView which a huge amount of text e.g. spanning 3 screens essentially as the user scrolls, are all the benefits of a recycler view essentially gone and I could…
1
vote
2 answers
1
vote
3 answers

Save a CustomView as Bitmap

I come from the following question (i asked): Saving the current view as a bitmap I'll give the maximum details i can in order to ask the question. My final goal, is to write a view with some information on it (will come later from an API, probably…
paboobhzx
  • 109
  • 10
1 2 3
99
100