android-widget

How my android app will run on multiple screen resolution devices?

妖精的绣舞 提交于 2019-12-22 14:58:47
问题 I have developed an android application and run it on an HVGA emulator. It's running successfully on any HVGA device i.e. mdpi. But if I try to run on small screen resolution devices i.e QVGA then my buttons are looking as if they go down and dont fit onto the small screen... So how can I run my android application on multiple screen resolution successfully? 回答1: follow these instructions create a folder in yourAppFolder/res/ named layout-small (*more on this subject later) insert in this

How do I change TextView font style in a Home screen widget?

早过忘川 提交于 2019-12-22 13:50:33
问题 How do I change the font style in a TextView in a Home screen widget? 回答1: If you mean in runtime, a simple way is: Text Size yourRemoteView.setFloat(R.id.textview, "setTextSize", 30); Text Color yourRemoteView.setInt(R.id.textview, "setTextColor", Color.RED); 回答2: Like this: First, define text styles in values/styles.xml : <resources> <style name="AppTheme" parent="android:style/Theme.Light"> .... </style> <style name="WidgetEntryTitle" parent="style/AppTheme"> <item name="android:textSize"

ScrollView don't scroll?

耗尽温柔 提交于 2019-12-22 12:39:18
问题 I've a ScrollView / RelativeLayout / FrameLayout and I inside put programmaticaly some widgets. Here is the gui xml : <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" android:background="@drawable/fond_app"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/titreAppli"

ScrollView don't scroll?

旧时模样 提交于 2019-12-22 12:38:14
问题 I've a ScrollView / RelativeLayout / FrameLayout and I inside put programmaticaly some widgets. Here is the gui xml : <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" android:background="@drawable/fond_app"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/titreAppli"

Setting transparency for widget background

六眼飞鱼酱① 提交于 2019-12-22 11:16:01
问题 I have a homescreen widget, with linear layout. I'm trying to set Alpha for the background during runtime using remote views, but the widget doesn't load. I'm using this: remoteView.setFloat(R.id.widget_background, "setAlpha", (float)0.7); Setting background color or text color the same way, works. How can I set the background transparency using remote views? 回答1: There is a simple solution using background color in hex. You have a color, for example RED - #ff0000 to set background red to

How to know when gallery widget stop scrolling?

送分小仙女□ 提交于 2019-12-22 10:54:51
问题 I need to start a process only when the gallery stop scrolling. "onItemSelected" doesn't cut it as it will be called continuously as if scroll by. So how to detect or callback when the gallery stop scrolling? 回答1: You can tune the behaviour of the galleryview a little bit with calling setCallbackDuringFling(false). This should limit the calls to onItemSelected to cases where the user stopped scrolling. 来源: https://stackoverflow.com/questions/4733798/how-to-know-when-gallery-widget-stop

XML Error in Eclipse while viewing Graphical Layout of Xml

一世执手 提交于 2019-12-22 10:07:14
问题 This is the error I'm getting in my layout XML files: Exception raised during rendering: 0 Exception details are logged in Window > Show View > Error Log The following classes could not be found: - View (Change to android.view.View, Fix Build Path, Edit XML) My Xml File is : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_view_main_lin_layout" android:layout_width="match_parent" android:layout_height="match

ExpandableList View don't expand

ぐ巨炮叔叔 提交于 2019-12-22 09:28:22
问题 I'm trying to personalize an ExpandableLisTview I create Iterator.Xml: with The ExpandableList View group.xml:A relative Layout with a simple TextView and a Button Child.xml:A relative layout with just a textView Class: package Android.MyExapandableListView; import android.app.Activity; import android.app.ExpandableListActivity; import android.os.Bundle; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android

Android layout: on TextView and android:drawableStart — setting size of the icon?

怎甘沉沦 提交于 2019-12-22 09:15:52
问题 The Lars Vogel's tutorial on SQLite, own ContentProvider and Loader uses the following layout for the list of ToDo items (check the http://www.vogella.com/articles/AndroidSQLite/article.html#todo_layout, todo_row.xml layout file): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <ImageView android:id="@+id/icon" android:layout_width="30dp" android:layout

How to dynamically set height and width of an ImageView in an Android widget to “match_parent”?

时间秒杀一切 提交于 2019-12-22 08:46:16
问题 There is one ImageView in my homescreen widget. In the layout file, I am setting the height and width to wrap_content . But depending on user's input, I have to change its height and width to match_parent . How can this be done ? RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout); Now I tried to use the setInt() method on this RemoteViews object like this to just check if it is possible to change height and width: rv.setInt(R.id.widgetImageView,