Is there such a method call "getBackgroundColor" in TextView? if I got 2 textViews: tv1 and tv2 in one LinearLayout. What I did:tv1.setBackgroundColor(Color.BLUE)
如今,如果I wanna将鸡肉类混凝土与tv1一样,那么我如何能够在上面标出Vtv1的“Color
Is there such a method call "getBackgroundColor" in TextView? if I got 2 textViews: tv1 and tv2 in one LinearLayout. What I did:tv1.setBackgroundColor(Color.BLUE)
如今,如果I wanna将鸡肉类混凝土与tv1一样,那么我如何能够在上面标出Vtv1的“Color
You will find the solution here : http://groups.google.com/group/android-developers/browse_thread/thread/4910bae94510ef77/59d4bb35e811e396?pli=1
这将是:
((PaintDrawable) tv.getBackground()).getPaint()
解决办法优于资助:
((ColorDrawable)view.getBackground()).getColor();
好处是,我们处于一种可与科罗州提供的彩色体格相当的愤怒之中。
规定背景颜色可与具体肤色相提并论,即以下例子可作罚款:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.some_layout_name);
TextView t1 = (TextView) findViewById(R.id.text1);
TextView t2 = (TextView) findViewById(R.id.text2);
t1.setBackgroundColor(Color.GREEN);
t2.setBackgroundDrawable(t1.getBackground());
}
不存在这种方法,因为现在有“背底色”——可以有<条码>可提取的<<>代码>物体(例如照片)。 因此,你应当记住你为案文所花的颜色。
如果您可以节省这笔费用,请使用<代码>View.setTag()和关于储存任何价值的相关方法。
它为我工作。
public static int getColor(View v) {
if(Build.VERSION.SDK_INT>=11)
{
return ((ColorDrawable)v.getBackground()).getColor();
}
else
{
try
{
Field f=View.class.getDeclaredField("mState");
f.setAccessible(true);
Object mState=f.get(v);
Field f2=mState.getClass().getDeclaredField("mUseColor");
f2.setAccessible(true);
return (int) f2.get(mState);
}
catch (Exception e)
{
}
}
return 0;
}
I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...
To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?
When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...
I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...
I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...