android-ui

How do I change the textColorPrimary in a theme?

喜你入骨 提交于 2019-12-04 03:13:12
I'm changing the theme of an activity in onCreate using setTheme (I'm doing that even before calling super.onCreate(), as this is supposed to be more reliable). It does work in the sense that it changes the background and foreground colors. However, my layout has a few elements that use styles like textAppearanceLarge. Now Android's textAppearanceLarge internally uses the textPrimaryColor - which is still unchanged by my theme. I tried to override the primary text color in my theme, but that doesn't seem to work. Here is the crucial part of the theme: <style name="Theme.MyApp.White"> <item

ShapeDrawable as progressDrawable for RatingBar in Android?

只愿长相守 提交于 2019-12-03 22:08:47
问题 It seems I cannot set ShapeDrawable as progressDrawable for Ratingbar. I tried the following but failed: <RatingBar android:id="@+id/ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:numStars="5" android:stepSize="1.0" android:rating="3.0" style="@style/myRatingBar" /> myRatingbar style: <style name="myRatingBar" parent="@android:style/Widget.RatingBar"> <item name="android:progressDrawable">@drawable/ratingbar

Create a 3d shaped button in android [closed]

╄→гoц情女王★ 提交于 2019-12-03 18:24:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I was trying to create a button similar in look to the round buttons over here - http://livetools.uiparade.com/index.html (every button looks like it is inside an immersed section) I had it by placing the button in a circle background and giving them both a little gradient that didnt end up the same though I got

Autocomplete textbox highlighting the typed character in the suggestion list

穿精又带淫゛_ 提交于 2019-12-03 18:00:24
问题 I have been working on AutoCompleteTextView . I was able to get the suggestion and all in the drop down list as we type. My question is: Can we highlight the typed character in the suggestion drop down list? 回答1: I have achieved the functionality. The solution is as follows: AutoCompleteAdapter.java public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filterable { private ArrayList<String> fullList; private ArrayList<String> mOriginalValues; private ArrayFilter mFilter;

Keyevent to click on Alert Dialog of Android screen

ぃ、小莉子 提交于 2019-12-03 17:08:44
Is there any way to simulate keyevent on "OK" or "CANCEL" buttons of Android dialogue box using adb commands? One indirect way is:- adb shell uiautomator dump /data/view.xml adb shell cat /data/view.xml calculate OK button coordinates from the relative coordinates given in the xml file. Then do adb shell input tap <x> <y> Hope works. Using AndroidViewClient/culebra you can simply do: run java -jar androidviewclient-2.3.25.jar culebra --verbose --verbose-comments --find-views-with-text=true --output=myscript.py edit myscript.py and add vc.findViewWithTextOrRaise('Cancel').touch() at the end

Memory leak through IClipboardDataPasteEventImpl

时光毁灭记忆、已成空白 提交于 2019-12-03 14:14:35
I noticed an odd memory increase in one of my Activities. Hence I ran a little test: I opened the dialog multiple times (open - close - open - close ....) and the memory kept increasing. So I used the DDMS to dump an HPROF file and opened it in MAT (Memory analyzer). The leak suspect report indicated, that the main reason for the growing memory consumption was this: So I did a histogramm, to check that dialog I ran my tests on and what's keeping it alive. Turns out, it's kept alive by it's AutoCompleteTextViews , which in turn are kept alive by android.widget.TextView

Android Night Mode without CarModeEnabled

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 12:28:54
So I made separate xmls for night mode and kept them in layout-night . Then I switch to night mode: UiModeManager uiManager = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE); if (nightMode) { uiManager.enableCarMode(0); uiManager.setNightMode(UiModeManager.MODE_NIGHT_YES); } else { uiManager.disableCarMode(0); uiManager.setNightMode(UiModeManager.MODE_NIGHT_NO); } Is it possible to set night mode without enabling car mode? or for that matter possible to use layout-night, values-night etc folders without using setNightMode() ? With 23.2.0(and higher) appcompat library it is possible

Android Fragment Tabs Example

我只是一个虾纸丫 提交于 2019-12-03 11:59:34
I am currently working on 2.3 version of android and I want to switch my app to 4.0 version but the TabActivity is deprecated. So I was looking for working example of FragmentTabs but I am not able to find one. Can anyone help? wyoskibum I've found the FragmentTabs example from the API Demos project to be very useful. Just create a new Android sample project from Eclipse and choose the API demos (try API 13). Also for the support (compatibility) library, there's a FragmentTabs demo in the Support4Demos also refer this link Android-FragmentTabHost-demo A great library is ActionBarSherlock. You

creating persistent search bar in android

本秂侑毒 提交于 2019-12-03 11:52:47
问题 I want a search box which sits on top of the layout like this: http://www.google.com/design/spec/patterns/search.html#search-in-app-search I do not know whether I have to build it myself from scratch using text boxes, white frames etc., or there is already a built-in widget or an open source work. Actually designing everything from scratch does not seem to me right. Because by doing so I would have a incompatible view or user experience in future android APIs. What are the options available

Animation not starting until UI updates or touch event

允我心安 提交于 2019-12-03 10:44:47
问题 I have a strange problem with an AlphaAnimation . It is supposed to run repeatedly when an AsyncTask handler is called. However, the first time the handler is called in the Activity , the animation won't start unless I touch the screen or if the UI is updated (by pressing the phone's menu button for example). The strange part is that once the animation has run at least once, it will start without problem if the handler is called again. Here's what the code looks like: // AsyncTask handler