English 中文(简体)
如何设定孩子版式的默认和机器人黑颜色, 而其父/ 父/ 母则有另一种背景颜色?
原标题:How to set default android black color for a child layout while its parent having another background color?

I have a child layout inside its parent layout. If i set any background color for parent, it sets the same color for its child also. But i don t want to set the same color for child. (I want the default android black color as background for child). Please help me.
EDITED:
I need to capture the child layout and create a bitmap later, So i should not set any background color for child (but its parent should has some color). It should set to default android black only.

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="#FFA500" >

    <RelativeLayout

        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:layout_margin="15dp"
        android:layout_weight="1"
        android:gravity="center" >
    </RelativeLayout>
</LinearLayout>

父线性布局有一些 BG 颜色。 我并没有为子子相对布局设置 BG 颜色, 但是它正在使用父色 s BG 颜色 。 所以, 现在, 我如何为子子设定和机器人默认 BG 颜色?

问题回答

If i set any background color for parent, it sets the same color for its child also

不,它没有。你的孩子只是有一个透明的背景 默认,所以它看起来像 它继承了颜色 从父母。只是设置它到其他的东西,而不是透明。

编辑 :

对不起,只是读读你的编辑。

如果您想要稍后将图像添加到您的子视图中, 而不是设置 < code> setBackgroundDrawable 或其它东西, 请使用 < code> setImageBitmap 。 它将会保留您子视图的透明颜色, 并同时显示您指定的图像 。

您可以将儿童布局的背景颜色设置为透明。

设定 :

and middroid: backfround= "00000000"; = "000000";

前两个十六进制数字是您背景的阿尔法元素 。





相关问题
Android - ListView fling gesture triggers context menu

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, ...

AsyncTask and error handling on Android

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 ...

Android intent filter for a particular file extension?

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 ...

Android & Web: What is the equivalent style for the web?

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 ...

TiledLayer equivalent in Android [duplicate]

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?

Using Repo with Msysgit

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 ...

Android "single top" launch mode and onNewIntent method

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 ...

From Web Development to Android Development

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 ...

热门标签