android-view

Android viewpager preview behind view

烈酒焚心 提交于 2021-02-08 09:52:49
问题 How can I get something like this sing viewpager in android? I've implemented a viewpager with depth page transformer, but I cant figure out a way to add the preview of the items behind. 回答1: The solution is this library: https://github.com/blipinsk/FlippableStackView 回答2: Here's my solution. I hope it helps. public class StackViewPager extends ViewPager { private static final float FIRST_PAGE_SCALE = 0.9f; private static final float SCALE_FACTOR = 0.1f; // each item scaled down on 10% of

Android: How to make Layout clickable when EditText is a child

ぐ巨炮叔叔 提交于 2021-02-07 09:40:08
问题 I have a Relative Layout with an EditText and an ImageView inside it. Under certain circumstances, I would like to make the whole layout clickable and not any of its children. I added an OnClickListener on the layout. And I tried the following with the children: 1. setEnabled(false) 2. setClickable(false) This works for the ImageView but even after the above changes, when I click on the area near the EditText, the keyboard comes up and I can see the cursor in the edit text. Instead of that, I

Android: How to make Layout clickable when EditText is a child

风格不统一 提交于 2021-02-07 09:36:27
问题 I have a Relative Layout with an EditText and an ImageView inside it. Under certain circumstances, I would like to make the whole layout clickable and not any of its children. I added an OnClickListener on the layout. And I tried the following with the children: 1. setEnabled(false) 2. setClickable(false) This works for the ImageView but even after the above changes, when I click on the area near the EditText, the keyboard comes up and I can see the cursor in the edit text. Instead of that, I

Using PixelCopy to copy a scaled View within a DialogFragment

独自空忆成欢 提交于 2021-01-29 05:33:47
问题 I have a DialogFragment that creates an AlertDialog with a custom view in onCreateDialog . The custom view includes a spinning progress bar and a prompt as well as a large view (larger than screen dimensions) that is fit inside the custom content via scaleX and scaleY values. I am using the PixelCopy API to copy only the large view into a bitmap. This works well, but with a rather annoying caveat: I call PixelCopy as such: val winloc = intArrayOf(0, 0) view.getLocationOnScreen(winloc) val

Programmatically set boxBackgroundMode to TextInputLayout

别来无恙 提交于 2021-01-28 20:21:03
问题 I just migrate from com.android.support:design to com.google.android.material . implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.google.android.material:material:1.1.0' I have the troubles with set up boxBackgroundMode as an outline for TextInputLayout programmatically. val textInputLayout = TextInputLayout(this) textInputLayout.addView(EditText(this)) textInputLayout.boxBackgroundMode = TextInputLayout.BOX_BACKGROUND_OUTLINE textInputLayout.boxStrokeColor = Color.BLACK

Android XML Is there a way to use the tool namespace with custom attributes?

自闭症网瘾萝莉.ら 提交于 2021-01-26 03:13:09
问题 I've created a custom view with attributes. Is there a way to use those attributes with android tools in Android studio? for example : <MyOwnCoolView android:layout_width="96dp" android:layout_height="96dp" android:padding="3dp" tools:dividerAngle="2"/> Where the attr file is : <resources> <declare-styleable name="MyOwnCoolView"> <attr name="dividerAngle" format="float"/> </declare-styleable> 回答1: My opinion is that you can't. There's an official, though very old, page here that quotes:

How to mirror the PreviewView in CameraX?

♀尐吖头ヾ 提交于 2021-01-24 14:39:05
问题 Disclaimer: I'm aware of the existence of this question, but it currently stands unresolved and I'm trying to provide extra information without polluting that one with useless answers that won't solve the problem anyway. I have a custom device with a front camera that is mirrored by default, so I want to display the preview normally and I need to horizontally flip the content of PreviewView, but I'm stuck. Other people in the past have suggested using PreviewView#setScaleX(-1) but it either

How to mirror the PreviewView in CameraX?

不问归期 提交于 2021-01-24 14:36:46
问题 Disclaimer: I'm aware of the existence of this question, but it currently stands unresolved and I'm trying to provide extra information without polluting that one with useless answers that won't solve the problem anyway. I have a custom device with a front camera that is mirrored by default, so I want to display the preview normally and I need to horizontally flip the content of PreviewView, but I'm stuck. Other people in the past have suggested using PreviewView#setScaleX(-1) but it either

How to add padding before CheckBox/RadioButton across API levels

允我心安 提交于 2021-01-24 14:05:03
问题 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 and the screen edge but also don't end up with a non clickable area where that space is. For API 16 and below I can add the spacing AND maintain clickability I can use the view's paddingLeft attribute. For API 17 and above this attribute controls

Create ImageView that is round, so click will work on round area only android

喜你入骨 提交于 2020-12-30 06:59:06
问题 Hi I am creating tabla App, For example It should not respond outside of round but ImageView is Rectangle so it is responding I am sure you can understand this problem ImageView is rectangle but it's image is round, but I want to detect click only on round image... 回答1: Thank you for your all support, based on your support I have done by below way and it is working perfect ImageView imgView = (ImageView) findViewById(R.id.imageView1); imgView.setOnTouchListener(new View.OnTouchListener() {