android-ui

Floating Toolbar with Appcompat

无人久伴 提交于 2019-11-28 19:53:13
How to create a floating toolbar like the following image as proposed in the material design guidelines and in the Google Map application. I've worked with the Toolbar before and all the comments from CommonsWare are absolutely correct. The Toolbar widget ( https://developer.android.com/reference/android/support/v7/widget/Toolbar.html ) have absolutely nothing special or different than any other Viewgroup and does not behave differently than any other ViewGroup. Put it inside a FrameLayout , put a layout_margin parameter on it, make the layout_width NOT match_parent and that's it. Put it

Setting webview background image to a resource graphic in Android

江枫思渺然 提交于 2019-11-28 18:49:20
问题 I'm trying to set the background of a webview to a drawable image resource in Android. From the sdk it seems something like this would work but it doesn't. WebView web = (WebView) findViewById(R.id.webView); web.setBackgroundResource(R.drawable.backgroundmain); web.loadData(profile, "text/html", "UTF-8"); Any idea's? 回答1: As always you tend to figure these things out as soon as you ask the question. For the benefit of others, the layout that I'm using, LinearLayout, can take a background

Detect soft navigation bar availability in android device progmatically?

妖精的绣舞 提交于 2019-11-28 18:15:05
I am trying to determine soft navigation bar through the android program. I didn't find straight way to determine. Is there anyway to find the navigation bar availability. Soft Navigation bar image is here. Following method worked for me and tested in many devices. public boolean hasNavBar (Resources resources) { int id = resources.getIdentifier("config_showNavigationBar", "bool", "android"); return id > 0 && resources.getBoolean(id); } Note: Verified this method in real device As i know you can detect it by boolean hasSoftKey = ViewConfiguration.get(context).hasPermanentMenuKey(); But it

Styling the popup menu in Android 5.0

你。 提交于 2019-11-28 18:01:27
I'm making my app ready for Android 5.0, I'm using the latest compatibility library, here is what my style looks like. <resources> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/theme_accent</item> <item name="colorAccent">@color/theme_accent_secondary</item> </style> <style name="AppThemeDark" parent="Theme.AppCompat"> <item name="colorPrimary">@color/theme_accent</item> <item name="colorAccent">@color/theme_accent_secondary</item> </style> </resources> (The ActionBar color is being set programmatically.) Now, I want the overflow/popup

How to selectively decorate RecyclerView items

瘦欲@ 提交于 2019-11-28 17:49:00
I am creating a subclass of ItemDecoration from this gist: https://gist.github.com/alexfu/0f464fc3742f134ccd1e How to make it only decorate items with certain condition? For instance, only decorate items with certain positions, type of ViewHolder, etc. I have modified the above mentioned gist (plus some changes on deprecated Android API) with this code, but all items get decorated anyway: public boolean isDecorated(View view, RecyclerView parent) { RecyclerView.ViewHolder holder = parent.getChildViewHolder(view); return holder instanceof MenuIconViewHolder || holder instanceof

remove border, padding from Dialog

纵饮孤独 提交于 2019-11-28 17:33:02
I have an activity which is with the theme Theme.Transparent which is: <style name="Theme.Transparent" parent="android:Theme.Dialog"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">false</item> <item name="android:windowIsFloating">true</item> <item name="android:backgroundDimEnabled">false</item> <item name="android:gravity">top</item> </style> i'm trying to get rid of the border and the padding around it.. i want to make fill the horizontal of the screen. and no gray border. please help :) Be sure to create your Dialog referencing your custom theme:

Anything like Twitter Bootstrap for Android?

℡╲_俬逩灬. 提交于 2019-11-28 17:00:06
问题 if you are a developer and have little clue about designs - Twitter Bootstrapt saves the day (at least for me). Is there something similar for android (native, not web)? Because at least for me the default buttons, and black background looks truly ugly (same as plain browser buttons, which Twitter Bootstrap makes so nice looking) http://developer.android.com/design/downloads/index.html gives some icons, and fonts, but maybe there is more ? 回答1: Android Bootstrap I recently came across this

How can I set a shadow in each cell of a ListView?

。_饼干妹妹 提交于 2019-11-28 15:52:06
问题 I have a custom cell for an Android ListView. This custom cell is a relative layout with some views inside. There is a space between each cell, so I want to add to the bottom of the cells a shadow. I've been googling around but couldn't found anything? I want to achieve something similar to this: Thanks! 回答1: Can be done in below two ways: 9-patch images - click link for understanding 9 patch Using layer-list - Create new file in "res/drawable" which contains: <?xml version="1.0" encoding=

Why Activity is hanging while coming back from another activity's few fragments?

一世执手 提交于 2019-11-28 14:39:31
I have two activities Activity A and B, Activity A has 3 fragments namely a1,a2 and a3. a3 is the default selected fragment which shows videos, a2 contains one big textView and a small edittext in it and a1 contains a listview. Now On activity A's title bar I have a button, and since it is on title bar it is visible from all 3 fragments. OnClick of this button I open Activity B. using Following function. public void inviteUser() { if ( getUserType() == ACTIVE ) { Intent intent = new Intent(this, B.class); intent.putExtra(Constants.MEETING_ID, (long) session.getSessionId()); intent.putExtra

Android UI - Android horizontal scroll view

℡╲_俬逩灬. 提交于 2019-11-28 12:11:25
Are there any samples similar to this? Android horizontal scroll view... Or how can I go about this? Hussain Try to have a look at these: Sample Sample2 Mark Mooibroek Pseudo: <LinearLayout android:orientation="vertical"> <HorizontalScrollView> <LinearLayout android:orientation="horizontal"> <Image1 /> <Image2 /> <Image3 /> <Image4 /> <Image5 /> </LinearLayout> </HorizontalScrollView> <LinearLayout android:orientation="horizontal"> <Button1 android:layout_weight="1" /> <Button2 android:layout_weight="1" /> <Button3 android:layout_weight="1" /> <Button4 android:layout_weight="1" /> <