android-widget

Creating Buttons Dynamically, Could I select one and deselect the other buttons?

别说谁变了你拦得住时间么 提交于 2019-12-04 16:31:47
I'm creating buttons dynamically ... for(int i=0; i<colSize;i++){ final Button btn = new Button(this); btn.setText(SectionName[i]); btn.setTextSize(10); btn.setPadding(8, 3,8, 3); btn.setTextColor(Color.WHITE); btn.setTypeface(Typeface.SERIF, Typeface.BOLD); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //***Every time that I click my button is selected !:) btn.setSelected(true); } }); } But how could I deselect the other buttons that were selected, I just want one Button selected! :) Declare a variable to store the Id of the Clicked Button :: private

How to change EditText pointer color (not cursor)

醉酒当歌 提交于 2019-12-04 16:11:10
问题 I'm trying to make the pointer color of EditText to become blue. I'm able to make the underline and the cursor to become blue, but the droplet looking pointer is still grey. I google a bit, but all the links that appear only talk about how to change the cursor, not the pointer. So if anybody knows how to do this, I need your help. I only need to support Android 5.0 and above. So if your solution only works on API > 21, that's totally fine. Thanks! 回答1: in your styles.xml put like this: <item

How can I create an AttributeSet from a style.xml?

不想你离开。 提交于 2019-12-04 16:08:51
问题 Here's my story: I got a custom ViewGroup that I want to create from code using a predefined style, my approach so far has been creating an AttributeSet object from a style.xml element, like so (warning, beware of the copy-paste code ahead): XmlPullParser parser = getResources().getXml(R.style.my_stylez); AttributeSet attributes = Xml.asAttributeSet(parser); But when doing so I get some crazy error: "..android.content.res.Resources$NotFoundException: Resource ID #0x7f090002 type #0x12 is not

Set Linear layout background dynamically

蓝咒 提交于 2019-12-04 16:02:57
问题 I wanted to set Linear Layout background dynamically in the following way: Fetch image from web url through XML parsing and then store that image into sd card. Now the image saved into sd card. Set that image as a linear layout background in the app. Now I am stuck in the third step. Can anyone help? 回答1: Use this: Bitmap bmImg = BitmapFactory.decodeStream(is); BitmapDrawable background = new BitmapDrawable(bmImg); linearLayout.setBackgroundDrawable(background); Also check this: How to

Advantage and disadvantage of CardView

萝らか妹 提交于 2019-12-04 15:50:31
问题 What are the advantages and drawbacks of CardView , other than the shadow or elevation, what is the benefit in performance and looks? What is done using CardView can also be done using a combination of other layouts. 回答1: Advantage of Cardview is definitely its default implementation of the shadow and the rounded corners, in simple words Cardview is just a FrameLayout with shadow and rounded corners. You can do almost the same stuff with a Cardview that you can do with a Framelayout (as

android UI external libraries?

筅森魡賤 提交于 2019-12-04 15:44:52
问题 I'm starting with android, and the app I'm developing is gonna need custom widgets look (glossy buttons, animated backgrounds etc.), I've googled for any external libraries to achieve this and did not find anything. let me guess, the only way to this is by painly extending base view classes and overriding onDraw etc. ? 回答1: You need to explore View Styles. You can customize almost any view element. You might not need any external library that extends and designs custom buttons. More ref: http

Where is the temp folder in android device?

女生的网名这么多〃 提交于 2019-12-04 15:05:50
问题 where is located the temp folder in the android phones??? 回答1: Reading this post from the android developers google group leads me to believe that there is not 1 global temp directory, and each application is expected to maintain their own temporary files. 回答2: The temporary directory is /data/local/tmp . I've seen some comments that claim you need to be rooted to access it but I'm not sure that's true. Whilst it is true that you need root to freely access /data , this is not required for

android:Page curl animation effect

淺唱寂寞╮ 提交于 2019-12-04 14:50:17
问题 If anybody have a Page Curl Effect example Demo so please give me link for this Thanks 回答1: Hardik ,there are already tons of questions out there see this http://www.google.co.in/search?hl=en&client=ubuntu&hs=FOq&channel=cs&q=page+curl+android+stackoverflow&aq=f&aqi=&aql=&oq= or refer this project android-page-curl 来源: https://stackoverflow.com/questions/5727276/androidpage-curl-animation-effect

How to bring up a widget on home screen programatically

旧街凉风 提交于 2019-12-04 13:34:25
问题 Programmatically I'm trying to bring a widget on the home screen but I am facing problem while passing the widget ID through an intent & calling startActivity(pickIntent) . The widget list is coming up but widget which I have developed is not getting selected. final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(component); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,

Just update a widget RemoteViews instead of completly creating a new one?

孤街醉人 提交于 2019-12-04 13:24:24
问题 So in my onUpdate method in my AppWidgetProvider class, I ended up executing a non-trivial amount of code so that I can completely recreate a new RemoteViews object. The reality is I really only need to be setting the text in one of the textviews in the RemoteViews each time I update. Is there anyway to just modify the RemoteViews that a particular widget is already using? -Kurtis 回答1: First, RemoteView is not a View. It's a set of instructions that build a View hierarchy. It is used to