android-widget

Updating GridView child

喜欢而已 提交于 2019-12-11 08:40:09
问题 I have a GridView loaded in an Activity with fragments present. The GridView itself is not located in a Fragment. I created a customer adapter by way of BaseAdapter and everything is working peachy. CustomerAdapter.java @Override public View getView( int position, View convertView, ViewGroup parent ) { ImageView v = new ImageView( activity ); Bitmap bmp = getBitmap( videoIds[ position ] ); v.setImageBitmap( bmp ); v.setAdjustViewBounds( true ); v.setPadding( 5, 5, 5, 5 ); v.setId( position );

How to move a TextView to an x and an y in a relativeLayout

拥有回忆 提交于 2019-12-11 08:08:30
问题 I have a relativelayout which contains some personnal TextViews. I need to place those textviews with an x and a y, so I do that: RelativeLayout layoutAnnotations = (RelativeLayout)findViewById(R.id.affichageFiche_layoutAnnotations); TextViewAnnotation tvAnno = new TextViewAnnotation(this,this,anno.getTexte(),anno.getFontSize()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params

How can i add a counter badge to a widget?

独自空忆成欢 提交于 2019-12-11 07:54:51
问题 How can I add a counter badge to a widget? Like in this screenshot Google Reader also has a widget with counter. 回答1: What is the problem? A home screen widget can have a layout, and that layout can contain an ImageView and a TextView. You will then create a background service that is checking how many messages there are e.g. every 15 minutes, and then update the widget. 来源: https://stackoverflow.com/questions/6123765/how-can-i-add-a-counter-badge-to-a-widget

I have a two imageView in a Relative Layout. Is it possible to change the Position of one imageview dynamically. while the other remain constant.?

北城以北 提交于 2019-12-11 07:53:29
问题 I have Two Image Views Defined in Xml. I want to Change the Position of One of them Dynamically while the Other remains constant.?? Any Suggestions. Thanx. 回答1: Yes off course, this is damn possible.Use LayouParam ImageView img1=(ImageView) findViewById(R.id.imageview); ImageView img2=(ImageView) findViewById(R.id.imageview); RelativeLayout.LayoutParams lp2=new RelativeLayout.LayoutParams(100, 100); lp2.addRule(RelativeLayout.ALIGN_RIGHT,img2.getId()); img1.setLayoutParams(lp2); Setting

widget on lockscreen

送分小仙女□ 提交于 2019-12-11 07:44:37
问题 I have read post here and also search for it, but haven't found answer. Is it possible add widget to lockscreen? I need it for music player control. Is there some way or only way is to create own lockscreen with lock, unlock implementation? I tried custom activity but it's displayed over the lockscreen and unlock is not visible until i press back and activity is closed. Thanks, vandzi 回答1: Solution for music player control on lockscreen is RemoteControlClient 回答2: Are you looking to make a

How to create EditText numeric (signed and unsigned decimal) from java code

为君一笑 提交于 2019-12-11 07:39:22
问题 this is a loop that creates a table of EditText and I wish they were numerical for (int i = 0; i < 3; i++) { tableRow = new TableRow(this); //oggetto di tipo tableRow tableRow.setGravity(Gravity.CENTER); for (int j = 0; j < 3 ; j++) { values[i][j] = new EditText(this); values[i][j].setText(" " + array[count]); values[i][j].setPadding(10, 10, 10, 10);//spaziatura di ogni cella per i quattro lati tableRow.addView(values[i][j]); count++; } tableLayout.addView(tableRow); } 回答1: values[i][j]

iGoogle Gadget on Android Phone as APP or Widget

半腔热情 提交于 2019-12-11 06:27:33
问题 I have added a gadget in my iGoogle to display orders from our e-commerce shopping cart. I would like to have it as a Widget for our Android phones. Anyone know where to start and what needs to be done? Link To iGoogle Gadget I have found that I can EMBED the html to a webpage, could this be useful in creating something that would appear on my phone? 回答1: That depends on what you mean by "widget" or by "APP". If by "widget" you mean "app widget" (interactive element of a home screen), what

Layout problem: scrollview inside a table, inside a custom dialog

时光毁灭记忆、已成空白 提交于 2019-12-11 06:24:34
问题 I have a layout problem which I can't fix. I've looked through many posts on here, and mine seems to be unique enough to post a question. I've created a custom Dialog which programmatically creates a 3 row table. The top and bottom rows have text, while the middle row contains a ScrollView, which contains a LinearLayout. That LinearLayout then contains some number of views (TextView in this example). Since I'm doing this programmatically, see the XML pseudocode below, and the actual code

Android RemoteViews: setImageViewResource() vs setImageViewUri() vs setImageViewBitmap()

我与影子孤独终老i 提交于 2019-12-11 06:16:09
问题 The following 3 methods (from RemoteViews class) can be used to update an image on a Home Screen widget, on Android: setImageViewResource (int viewId, int srcId) setImageViewUri (int viewId, Uri uri) setImageViewBitmap (int viewId, Bitmap bitmap) But after lot of research, I found that setImageViewUri() is the best one to use, to avoid the error "**!!! FAILED BINDER TRANSACTION !!!**" that can happen when updating the widget. But why is this the case? I couldn't find any proper reason or

Customized GUI components for Android in eclipse

大憨熊 提交于 2019-12-11 05:49:13
问题 You know how in eclipse you can edit the XML file using the built-in eclipse GUI for adding GUI components? I'm looking to create my own component that I can add so I can drag and drop like the rest of the components. I've looked for a tutorial to no avail and couldn't find anything. Does anyone know how to do this? Mind you I am using Java. 回答1: You can create custom layout or component by creating a class that extends ViewGroup or the component (Ex: Button) that you want to create. This