android-ui

Style Android SearchView Drop down popup

感情迁移 提交于 2019-12-03 08:22:16
问题 I would like to know how to style the drop down popup of the Android 4.0 SearchView ? I'm using the Theme.Sherlock.Light.DarkActionBar , but I don't know how to style the drop down search into a white background and a black text? 回答1: For some reason theming using the "searchAutoCompleteTextView" wasn't working for me either. So I solved it using the following code when setting up my SearchView: Note: This is all done with the android v7 support/AppCompat library public boolean

Is there a simpler/better way to put a border/outline around my TextView?

淺唱寂寞╮ 提交于 2019-12-03 08:19:27
问题 So I wanted to have a TextView with a cool border around it. I couldn't find any standard way of doing it, so I came up with this: @drawable/custom_bg_1: A blue rounded shape <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#439CC8"/> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> @drawable/custom_bg_2: A white rounded shape <

Dynamically position right corner arrow of the ActionBar Spinner based on length of displayed title

时光怂恿深爱的人放手 提交于 2019-12-03 08:14:12
In the Google+ App, the position of the right corner arrow of the ActionBar Spinner adapts to the length of the current string showing. For example, the Spinner's length seems shorter when Family is picked versus when Acquaintances is picked. What do I have to do to get the right corner arrow to position dynamically based on the title's length? My guess is that there's an attribute I can set in styles.xml that will do that for me. Here's my styles.xml: <style name="MyStyle" parent="android:style/Theme.Holo"> <item name="android:actionDropDownStyle">@style/MyDropDownNav</item> </style> <style

Why does calling setScaleX during pinch zoom gesture cause flicker?

余生颓废 提交于 2019-12-03 08:09:30
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 scaling would happen on the GPU once the texture was uploaded and thus would be super fast. But it made no

Change View content in activity dynamically

安稳与你 提交于 2019-12-03 07:38:54
My abstract class extended from Activity class consists of three View s as described in the following XML snippet: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/bg"> <LinearLayout android:id="@+id/top_border"> ... </LinearLayout> <View android:id="@+id/activity_content" ... /> <LinearLayout android:id="@+id/bottom_border"> ... </LinearLayout> </LinearLayout> And in onCreate() method I set this XML

Layout like Cards in android

泄露秘密 提交于 2019-12-03 06:57:38
问题 I want to make an android layout like Google Cards,i know there is an Open Source Libraries, however i want only the Layout and the gray hex background style. I could not find information about this, how i can make this possible? im Attaching new Google maps v7 Layout so you can get the idea. 回答1: bg_card.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#CCC" /> <

Android Icon Sizes [duplicate]

感情迁移 提交于 2019-12-03 06:44:44
This question already has answers here : About Android image and asset sizes (4 answers) 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 DeeV The ratios are .75|1|1.33|1.5|2.|3.|4. (or 3:4:6:8:12:16) That is, for your 10x10px bitmap, the graphics would be ldpi -

How to create Android Google Play's Grid View like Widget with different size images loaded dynamically

青春壹個敷衍的年華 提交于 2019-12-03 06:22:44
问题 Hi I have enclosed two app images which has grid view like widgets with different image heights and widths, loaded dynamically ,i need to create the same type of UI ,i could be glad if someone guide me to start with. 回答1: A similar question was asked previously and this is the answer. The developer used Bucket List Adapter to create the google play like list view. 来源: https://stackoverflow.com/questions/13191426/how-to-create-android-google-plays-grid-view-like-widget-with-different-size-im

How to create modal dialog box in android

余生长醉 提交于 2019-12-03 05:56:50
问题 i want create modal dialog box for my application. so when modal dialog box open the other activities are blocked. no event are done like back button press or home button press. and put two option button in that dialog box cancel and ok. Thank you... 回答1: There are many kind of Dialogs in Android. Please take a look at Dialogs. I guess what you are looking for is something like AlertDialog . This is the example of how you can implement on BackPress button. @Override public void onBackPressed(

Why use AsyncTaskLoader with LoaderManager, instead of simple Handler?

孤人 提交于 2019-12-03 05:19:46
问题 Running asynchronous tasks off of the UI thread then modifying the UI is a common issue in android development, so I decided to take some time, research, and play around with different techniques and find what works best for me. What I considered important factors: Should work reliably Code readability Activity or Fragment should be kept clean of as much of thread management as possible Here is the summary of my impressions (which may be wrong and some are just opinions) about the various