android-ui

Android- How to differentiate Galaxy S-3 and Galaxy S-4 layouts?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 13:24:22
问题 I am having problem differentiating layout folders for samsung galaxy s4 and samsung galaxy s3. I have tried layout-sw360dp, layout-sw360dp-xxhdpi, layout-sw360dp-xhdpi etc. All the time galaxy s4 and galaxy s3 both picks from layout-sw360dp-xhdpi. So what should be the correct layout folder for both of these devices ? 回答1: I am using some specific resolution values in my projects in order to differentiate these from other layouts and screens. You can create layouts with exact minimum height

ImageButton change background colour on click

主宰稳场 提交于 2019-12-10 12:20:01
问题 How I can make my ImageButton change its color when I click it? I want to do something like this : Button(Blue) -> Click -> Button(Red) -> Click -> Button(Blue) -> Click -> Button(Red) when I click it switch color and when I click again it goes back to original. I've tried to do like this: mTrashFlag = !mTrashFlag; ImageButton bt = (ImageButton)findViewById(R.id.trash_button); if(!mTrashFlag) { bt.setBackgroundColor(0x4CB8FB); } else { bt.setBackgroundColor(0xff0000); } but it didnt work. It

What is the use of 9patch PNG?

柔情痞子 提交于 2019-12-10 11:19:04
问题 I read article (Android Developers) on 9patch PNG in Android. But I'm not getting what is the real use of it ? If i use Gradient Image then it is going to behave same as 9Patch PNG. I had discussion with my graphics designer, he was telling me that it is same as Image Repeat used in CSS. Is it so ? -Thanks 回答1: No it's not the same. Think about a button you want to give a new look. With the 9patch way you simply design your button's design in a image editing program like e.g. Photoshop and

Navigation Drawer - Slowly animate menu items

余生长醉 提交于 2019-12-10 10:31:16
问题 I've implemented a DrawerLayout with this tutorial and everything works fine. @Override public boolean onPrepareOptionsMenu(Menu menu) { // if nav drawer is opened, hide the action items boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); menu.findItem(R.id.action_settings).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } onPrepareOptionsMenu simply toggles the menu visibility in one shot. But I'd like to slowly animate the alpha value of my menu items as the

Integrating uiautomator test case with application code in Android

丶灬走出姿态 提交于 2019-12-10 10:18:51
问题 I am using Eclipse IDE. Here is my code for uiautomator testcase: public class caltest extends UiAutomatorTestCase { public void testDemo() throws UiObjectNotFoundException, IOException { //mytesstcode } } To run this test i have to issue following commands from command line: /tools/android create uitest-project -n -t 1 -p Go to the project directory where your build.xml file is located and build your test JAR. ---> ant build Deploy your generated test JAR file to the test device by using the

Instantiating a View on non-UI thread

纵饮孤独 提交于 2019-12-10 10:17:14
问题 I know that the UI elements (View hierarchy) may only be manipulated from the UI thread. For a background operation, the AsyncTask can be used, which offers event handlers to reach the UI thread. To be brief, is it allowed to instantiate a View (tied to getApplicationContext() ) in a non-UI thread? This custom View descendant -- once instantiated -- is added to the view hierarchy from the UI thread . So only the constructor call is done inside an Asynctask.doInBackground() ; it's attaching (

expandable-spinner : How to implement expandable spinner entry in Android

与世无争的帅哥 提交于 2019-12-10 10:16:55
问题 I am building an Android application, in which i've a spinner item. The spinner entry is a category, and there are sub category in each category. I want to implement a UI, such that, when i click a spinner entry, i must get another spinner, showing the sub-categories for that category. (Something like how Windows Program menu works). Here's and image of what it must look like - Consider the drop down as a spinner. I figured out these many ways - Implementing Spinner of Spinners. Populating

Android layout with vertical tabs - design like hello sms app

こ雲淡風輕ζ 提交于 2019-12-10 09:21:07
问题 Can somebody please help me out in designing vertical tabs like in the given pic(taken from hello sms app) I'm not asking for a code snippet , so please don't ditch this question as a homework type. What I would want to know is the approach that I should take. Do I have extend the stock TabLayout or an existing tablayout with a few styles and UI customizations? Your pointers to the right resource would be of great help. Thanks 回答1: you can achieve this using multipane layout in android. on

Designing EditText with rounded corners & inner shadow

喜夏-厌秋 提交于 2019-12-09 16:44:53
问题 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=

Horizontal swiping in stackview

大城市里の小女人 提交于 2019-12-09 07:00:15
问题 I am in an app which requires stackview. But I have to implement horizontal swiping to switch between stackview items and UI looks as that of as normal one. Please help me to make it. I have already checked this link. But in it UI is just a cover flow. I want to make the UI look same as stackview. 回答1: iam create a custom stack-view public class custom_stackview extends StackView{ float x1, x2, y1, y2, dx, dy; public custom_stackview(Context context, AttributeSet attrs) { super(context, attrs