android-layout

Using Layout resources in a LiveWallpaper on Android

假如想象 提交于 2020-01-12 05:47:08
问题 When you create a LiveWallpaper in Android 2.2+ you get a canvas (or whatever the 3D equivalent is) to draw on. I'd like to draw some elements using the built-in Android UI tools rather than building everything from scratch using canvas commands or a loading a pre-rendered UI bitmap. Converting a single View to a Bitmap works fine. i.e. this works great: // For example this works: TextView view = new TextView(ctx); view.layout(0, 0, 200, 100); view.setText("test"); Bitmap b = Bitmap

Android Layout design principles [closed]

给你一囗甜甜゛ 提交于 2020-01-12 05:45:48
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I have been doing a lot of research on the best ways to design layouts for different screen sizes, screen density and orientations and I am getting increasingly confused. 1. Design Density vs Screen Size I have read this link Now when designing for gingerbread what should be

Create, store and inflate custom layout in runtime

人盡茶涼 提交于 2020-01-12 05:31:07
问题 I'm trying to find a solution for the following problem. The application I work on requires a possibility for user to produce custom UI (layout of simple widgets) via custom UI builder. So, user may stack widgets (images, mostly. But TextViews and EditText, as well) on canvas, move them around, etc. UI have to be stored in a database for future use. So, there should be some mechanism for loading and inflating of this UI. This is the main problem. My first idea was to rely on standard Android

Round only top corner of cardview

倾然丶 夕夏残阳落幕 提交于 2020-01-12 04:10:39
问题 I want to corner only the top of a cardview. I used below property and it is rounding all the corner. I want to show an overlap of all cards card_view:cardCornerRadius="4dp" here is my layout <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="match_parent" card_view

Implement onClick only for a TextView compound drawable

别来无恙 提交于 2020-01-12 04:01:10
问题 I need to have some text with a drawable on the left and I want to execute some code when the user clicks/touches the image (only the image, not the text), so I used a LinearLayout with a TextView and an ImageView which is clickable and launches an onClick event. The XML parser suggests me to replace this with a TextView with a compound drawable , which would draw the same thing with far less lines of XML .. My question is "can I specify I want to handle an onClick event only on the drawable

Android views expand animation

三世轮回 提交于 2020-01-12 03:58:07
问题 I'm trying to edit these source to create a simple function that will work on all of my views. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); RelativeLayout mLayout1 = (RelativeLayout) findViewById(R.id.layout1); RelativeLayout mLayoutToBeExpanded1 = (RelativeLayout) findViewById(R.id.layout_exp_1); addAction(mLayout, mLayoutToBeExpanded); RelativeLayout mLayout2 = (RelativeLayout) findViewById(R.id.layout2);

How can I make my Android SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons)

自作多情 提交于 2020-01-12 03:20:51
问题 How can I make my SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons) So far I have created an android application which allows the user to swipe Cardviews either to the left or to the right. Each card has 2 buttons, which at a later date I will assign functions to. (As the image below shows): What I would like to accomplish is (but don't yet know how), is instead of swiping to the left or right to completely remove a card. Instead I would like either swipe gesture, to

Android Widget Bitmap Sizes

半城伤御伤魂 提交于 2020-01-11 19:54:33
问题 Hallo, I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density. According to the Android Developer App Widgets tutorial: To find your minimum width and height in density-independent pixels (dp), use this formula: (number of cells * 74) - 2 Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells So if my widget is 72dp x 294dp, what size bitmaps do I need for my ldpi, mdpi and hdpi

Android Widget Bitmap Sizes

為{幸葍}努か 提交于 2020-01-11 19:53:02
问题 Hallo, I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density. According to the Android Developer App Widgets tutorial: To find your minimum width and height in density-independent pixels (dp), use this formula: (number of cells * 74) - 2 Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells So if my widget is 72dp x 294dp, what size bitmaps do I need for my ldpi, mdpi and hdpi

App crashing after theme update

时光总嘲笑我的痴心妄想 提交于 2020-01-11 14:48:07
问题 The app I was working on so far was working fine until I added a couple of new activities and tried applied some changes to the theme. The following is my styles.xml file. I looked into other results and added a parent to AppTheme as I was getting an error regarding AppCompat earlier. I also made AppTheme parent of NoActionBar. One thing I noticed was when I apply AppBarOverlay to Register User Activity it crashes and when I apply other it doesn't. Main Activity is crashing regardless.