简体   繁体   English

在android中自定义主题的布局

[英]Custom theme of a layout in android

I am trying to do this as shown in picture. 我试图这样做,如图所示。 I want my relative layout to look like this. 我希望我的相对布局看起来像这样。 How can i do that. 我怎样才能做到这一点。 Themes, styles etc. Just give me hint and ideas 主题,风格等等。只是给我提示和想法

Best Regards 最好的祝福

在此输入图像描述

you can try this : 你可以试试这个:

create folder in res called:( drawable ) ,then create XML called ( row_shape.xml ) as shape inside it ,then write this on it : 在res中创建名为:( drawable)的文件夹,然后在其中创建名为(row_shape.xml)的XML作为形状,然后在其上写下:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
       android:shape="rectangle">
  <stroke android:width="2dp" android:height="2dp" android:color="your color" /> 
  <solid android:color="your color" /> 
  <padding android:left="2dp" android:top="2dp" android:right="2dp"
       android:bottom="2dp" /> 
  <corners android:radius="10dp" android:bottomRightRadius="10dp" 
     android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" 
    android:topRightRadius="10dp" /> 
</shape>

then in layout Xml refer to shape as : android:background="@drawable/row_shape" 然后在布局Xml中将形状称为:android:background =“@ drawable / row_shape”

HOPE THIS HELP 希望这个帮助

Because the question is vague, I'm not quite sure where you stand code wise. 因为这个问题含糊不清,所以我不太清楚代码明智的地方。 But here is a link that will bring you to the Android Developer Guide relating to themes and how to implement them. 但是这里有一个链接,它将带您进入与主题相关的Android开发人员指南以及如何实现它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM