android-ui

How to block UI for some seconds in android?

瘦欲@ 提交于 2019-12-04 13:12:47
How can i block UI from all interactions for some seconds by user in Android? I would like to know, how to do this with some delay timing like wait(5000); You can override dispatchTouchEvent and stop the call to super.dispatchTouchEvent(ev); Any touch event will have to go through this method before it is handled. Set a boolean that you control and use it in the method to determine whether you wish to block control. private boolean stopUserInteractions = false; public boolean dispatchTouchEvent(MotionEvent ev) { if (stopUserInteractions) { return true; } else { return super.dispatchTouchEvent

Why does calling setScaleX during pinch zoom gesture cause flicker?

烈酒焚心 提交于 2019-12-04 11:32:53
问题 I am trying to create a zoomable container and I am targeting API 14+ In my onScale (i am using the ScaleGestureDetector to detect pinch-zoom) I am doing something like this: public boolean onScale (ScaleGestureDetector detector) { float scaleFactor = detector.getScaleFactor(); setScaleX(getScaleX() * scaleFactor); setScaleY(getScaleY() * scaleFactor); return true; }; It works but the zoom is not smooth. In fact it noticeably flickers. I also tried it with hardware layer thinking that the

Android Icon Sizes [duplicate]

爷,独闯天下 提交于 2019-12-04 11:09:47
问题 This question already has answers here : About Android image and asset sizes (4 answers) Closed 4 years ago . I know there are guidelines for creating icons for specific areas in Android (Tab, List, etc.) and how you would size them according to ldpi, mdpi, hdpi etc. Are there any rules on how to scale other in-app icons? I've got a 'tiny' icon of 10x10 px which I am using on my mdpi dev phone, what would be the scaling rules to create ldpi, hdpi & xhdpi versions of that icon? Thanks Dave 回答1

Can Android WebView HTML influence keyboard or keyboard features?

↘锁芯ラ 提交于 2019-12-04 09:22:58
问题 I have a webview with a credit card entry form (with standard <input type="text" /> fields). In different versions of Android I get different keyboards. Kit-Kat seems to not show Prev / Next keys when inside the form. On the web side, do I have any influence over this? If not, what should I recommend to the developer for the Android side? Example without Prev / Next : Same webview, with Prev / Next : 回答1: You can control the keyboard from the WebView, but as other answers suggest it may not

Android MediaPlayer reset freezes UI

纵饮孤独 提交于 2019-12-04 08:39:04
问题 I have a problem with the Android MediaPlayer when changing the dataSource of the player. According the specification of the MediaPlayer (http://developer.android.com/reference/android/media/MediaPlayer.html) I have to reset the player when changing the dataSource . This works fine, but as soon as the channelChanged method is called twice in quick succession the MediaPlayer.reset freezes the UI. I profile the code as seen here: public void channelChanged(String streamingUrl) { long m1 =

Listview item's background with gradient in Fragment

有些话、适合烂在心里 提交于 2019-12-04 06:17:03
问题 I've got a problem, using gradient in background for listview's items inside fragment activity (using ABS). So, first of all I've got a background, that is succesfully using in other application. It has a gradient from (r = g = b = 91) to (r = g = b = 81). And thats how it looks in simple activity: And thats how it looks inside fragment activity: At first I think that it is very big gradient and I did a gradient only for 2 points, from (r = g = b = 80) to (r = g = b = 78). And thats what I

Android Dim Background of Custom Dialog

青春壹個敷衍的年華 提交于 2019-12-04 05:36:43
As titled, I cannot seem to be able to dim the background of the custom dialog box I have made. Countless solutions online mention the last 3 lines of code in the first snippet below, this has made no impact on the UI of the dialog box. See the following code: Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog); TextView textView = (TextView) dialog.findViewById(R.id.textView); textView.setText("Custom Text Example"); dialog.show(); WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes(

Designing EditText with rounded corners & inner shadow

大兔子大兔子 提交于 2019-12-04 05:14:41
I'm trying to create a custom EditText that has both rounded corners and an inner shadow. I made a layer list that creates the inner shadow, <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item > <shape android:shape="rectangle"> <solid android:color="#6C6C6C" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="@color/ashes" /> </shape> </item> <!-- White Top color --> <item android:top="3px" android:left="3px"> <shape android:shape="rectangle"> <solid android:color="#FFFFFF" /> </shape> </item> </layer-list> The output looks like this,

Android - Button with rotating/spinning 'loading' image when pressed

天大地大妈咪最大 提交于 2019-12-04 03:56:34
I have a big 'Log in' button on my app. When the user taps this button, I want to replace the text with 'Logging in...', align it to the left instead of center and put a spinning circle on the right (but still inside the button). I'd like to use essentially the same button (but with different initial and loading text) in other places in my app. What's the neatest way to do this? For the actual spinning graphic, I was planning to use the @drawable/spinner_white_16 that comes with Android. Thanks. You can create your own button using a RelativeLayout containing a TextView and an ImageView.

Replace the action bar's title with a spinner (drop down)

雨燕双飞 提交于 2019-12-04 03:42:25
I am trying to display a spinner in the same position where the action bar's default title appear. I followed the instruction of the similar SO case here , so I managed to eliminate the title but still the spinner's position is not aligned to the left, as you can see from this screen-shot Here are the main definitions of my application to reproduce this case: AndroidMenifest.xml: <application android:label="app" android:icon="@drawable/ic_launcher" android:theme="@style/Theme.AppCompat" > ... <activity android:name="gm.activities.ViewAllActivity"> <meta-data android:name="android.support