导航:首页 > 操作系统 > android分割线颜色

android分割线颜色

发布时间:2022-06-20 06:49:58

android listview每条记录下都有一条分隔线,如何去掉分割线

可以用下面几种方法
1,设置android:divider="@null"也即不为listview设置分割线
2,设置android:divider="@android:color/transparent"就是分割线透明,相当于没有分割线,不过分割线还是会占一些位置
3,设置android:dividerHeight="0dp"设置分割线高度为0,也就没有分割线了

Ⅱ android listView底部分割线怎么显示出来

1. ListActivity有这条底部分割线。
2.在Activity中只有listview,没有别的控件的话也会有。
其实ListActivity也是一个Activity,只不过在其中使用了SetContentView(listView)方法设置了一个listView作为其显示的View而已。所以结论就是只要这个activity调用了SetContentView(listView)就会有这条底部分割线。
那么什么情况下才不会有这条分割线呢?在Activity中如果调用setContentView(View)而ListView只是内嵌入到这个View的话有可能会没有这条分割线
在一个Activity中只有一个ListView,把它的layout_height修改为fill_parent,最底下的线是可以显示出来的,但修改为wrap_content就显示不出来了,(一般情况我们把高度都是设置成fil_parent的)
在一个Activity中最上边和最下边都有个TextView,ListView夹在中间,把它的layout_height为fill_parent或者wrap_content,最底下的线是可以显示出来的。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 现在无此属性

android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/mTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="HelloWorldTop"
/>
<TextView
android:id="@+id/mBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="HelloWorldBottom"
/>
<ListView
android:id="@+id/mList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mTop"
android:layout_above="@id/mBottom"/>
</RelativeLayout>

Ⅲ androidstudio怎么设置分割线

android studio设置分割线的话,在xml布局文件里面,你可以使用view,这是宽度或者高度为1px就行。

Ⅳ android中设置分隔线有几种方法

方法一

也是我们常用的方法,可以在按钮间添加作为分割线的View,设定好View的宽度高度和颜色值后插入按钮的布局间。

View的样式如下:

android:layout_height="fill_parent"

android:layout_width="1dp"

android:background="#90909090"

android:layout_marginBottom="5dp"

android:layout_marginTop="5dp"

/>

Ⅳ android menu 分割线怎么实现,箭头所指的地方

用一个view即可,高度自定,宽度1dp ,颜色自定(background设置一个颜色比如:#50FFFFFF 50代表透明度,6个F代表白色)。 上下居中,再定义一下外边距即可。

Ⅵ android 如何设置listview的分割线为虚线

楼主,你的这个问题我遇到过,并且用另一种方式解决了。
首先告诉你,listview的分割线不能设置为虚线,你也知道关于它的两个属性:
android:divider="#FFCC00"(或者android:divider="@color/divider_color")
android:dividerHeight="4px"
一个是设置颜色,一个是设置高度。没法设置为虚线。
---------------------------
我的做法是这样的!比较暴力,但能解决问题。
让美工给你做一个虚线的图!保存为 xuxian.png
然后再用android:divider="@drawable/xuxian",把它设置为这个图。看上去就是个虚线了。至于效果,让美工和你一起再慢慢细调。
结论是:很绝望。目前只有这一个办法,可以解决你的问题。
手动打字,非ctrl+c / ctrl+v之流。但愿能帮到你

Ⅶ android 19 listview分割线默认颜色值是多少

刚刚在android19 SDK下写了一个listview 然后用ps获取到listview分割线的颜色值 十六进制:d8d8d8 RGB:216 216 216

Ⅷ android怎么设置listview中的每个item之间的分割线

android:divider="@null" 这是去掉分割线
android:divider="#00000000"这是设置分割线透明,也相当于去掉分割线
android:divider="#fffff" 这是设置分割线颜色
android:dividerHeight="1px" 设置分割线高度

Ⅸ 如何设置actionbar让分割线改变颜色

android 布局 layout relativelayout

除了沉浸模式外,Android 4.4还有新的API,能使应用内的状态栏和虚拟按钮透明。其他更多的Android 4.4 APIs可以看这里。

如果要使应用内的状态栏和虚拟按钮变成透明有两种方法。

一种是代码方式:

?1

2

3Window window = getWindow();

window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

另外一种是使用两个新的主题风格:

Theme.Holo.NoActionBar.TranslucentDecor和Theme.Holo.Light.NoActionBar.TranslucentDecor。

但是这种方式只支持Android4.4以上系统,所以为了保持兼容性,我们还是采用代码方式比较好。只需要先判断,如果是4.4以上系统才启用代码。

开启后上下系统栏都透明了。

但是如果应用本身是带有actionbar或者标题栏的话会就会变得比较尴尬,内容会在上面露出来。这个时候需要在布局文件里加入android:fitsSystemWindows="true"。

android:id="@+id/layout"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="#c8c8c8" >

android:id="@+id/listview"

android:layout_width="match_parent"

android:layout_height="match_parent" />

但是这样的话内容就不能从透明的虚拟按钮下穿过,没原来那么好看。我们可以按照以前一样把根布局设置一个高度为系统栏高度和ActionBar高度的内边距就可以。

同时关于获取ActionBar和状态栏的高度,发现用原来的方法有时候会获取的值为0。自己google找了一下,找到两个前辈提供的获取高度方法,获取ActionBar高度,获取状态栏高度。

8if (android.os.Build.VERSION.SDK_INT > 18) {

Window window = getWindow();

window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

//设置根布局的内边距

RelativeLayout relativeLayout = (RelativeLayout)
findViewById(R.id.layout);

relativeLayout.setPadding(0, getActionBarHeight()+getStatusBarHeight(), 0,
0);

}

27// 获取手机状态栏高度

public int getStatusBarHeight() {

Class c = null;

Object obj = null;

Field field = null;

int x = 0, statusBarHeight = 0;

try {

c = Class.forName("com.android.internal.R$dimen");

obj = c.newInstance();

field = c.getField("status_bar_height");

x = Integer.parseInt(field.get(obj).toString());

statusBarHeight = getResources().getDimensionPixelSize(x);

} catch (Exception e1) {

e1.printStackTrace();

}

return statusBarHeight;

}

// 获取ActionBar的高度

public int getActionBarHeight() {

TypedValue tv = new TypedValue();

int actionBarHeight = 0;

if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))//
如果资源是存在的、有效的

{

actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
getResources().getDisplayMetrics());

}

return actionBarHeight;

}

接下来,因为我自己写的一些应用是暗色的主题的,会导致透明的状态栏和ActionBar颜色不太协调。看到有一些应用是把状态栏的颜色设置成和ActionBar一样,这种解决方法也不错。

具体是怎么实现的也不太清楚,我自己猜测写了一个差不多状态栏。我是直接在根视图加入一个高度为状态栏高度的TextView,背景设置为和ActionBar一样。具体代码如下:

8// 创建TextView

TextView textView = new TextView(this);

LinearLayout.LayoutParams lParams = new
LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, getStatusBarHeight());

textView.setBackgroundColor(Color.parseColor("#3F9FE0"));

textView.setLayoutParams(lParams);

// 获得根视图并把TextView加进去。

ViewGroup view = (ViewGroup) getWindow().getDecorView();

view.addView(textView);

在模拟器上看还行,但是在实际的手机当中总感觉ActionBar有点过大,所以我在背景色里加入了一些渐变,在实体手机中就比较好看一点,不会觉得ActionBar太宽了。

android:startColor="#c8c8c8"

android:endColor="#3F9FE0"

android:angle="270"

android:type="linear"/>

Ⅹ android分割线设置怎么弄

方法一也是我们常用的方法,可以在按钮间添加作为分割线的View,设定好View的宽度高度和颜色值后插入按钮的布局间。
View的样式如下:
<View
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/>

相应的布局如下:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:orientation="horizontal">

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Yes"
android:layout_weight="1"
android:id="@+id/button1"
android:textColor="#00b0e4" />

<View android:layout_height="fill_parent"
android:layout_width="1px"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:id="@+id/separator1" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="No"
android:layout_weight="1"
android:id="@+id/button2"
android:textColor="#00b0e4" />

<View android:layout_height="fill_parent"
android:layout_width="1px"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:id="@+id/separator2" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Neutral"
android:layout_weight="1"
android:id="@+id/button3"
android:textColor="#00b0e4" /></LinearLayout>

方法二
通过LinearLayout指定的divider的属性来插入分隔符,类似于Listview的效果。这种方法的好处在于缩减布局代码量,同时在button数量未知的情况下能更方便的进行显示。但是这种方法只适用API版本11以上的机型。
使用方法也很简单,先创建分隔线的样式文件
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="1dp" />
<solid android:color="#90909090" /></shape>

再在布局文件中引用
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:divider="@drawable/separator"
android:showDividers="middle"
android:orientation="horizontal">

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Yes"
android:layout_weight="1"
android:id="@+id/button1"
android:textColor="#00b0e4" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="No"
android:layout_weight="1"
android:id="@+id/button2"
android:textColor="#00b0e4" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Neutral"
android:layout_weight="1"
android:id="@+id/button3"
android:textColor="#00b0e4" /></LinearLayout>

最主要的代码如下
android:divider="@drawable/separator"
android:showDividers="middle"

当然分隔线的样式也可以用图片来替代,这就看项目的需求了。

阅读全文

与android分割线颜色相关的资料

热点内容
java优化线程 浏览:324
数据仓库拉链算法 浏览:532
php中怎么注释 浏览:994
adxl345与单片机 浏览:281
服务器世界第一是什么公司的 浏览:21
精通编程入门 浏览:16
99单片机原理 浏览:61
linuxssh互信 浏览:288
支持128加密的浏览器 浏览:293
程序员下载器 浏览:48
退出云服务器代码 浏览:900
军状如命令 浏览:263
如何安卓系统更新 浏览:74
linux命令在哪里输入 浏览:497
编程语言集合类怎么选 浏览:93
如何将pdf转化为word 浏览:11
迈克菲隔离区解压密码 浏览:785
怎么用伟福编译 浏览:867
计算机算法专家 浏览:502
什么app清理垃圾 浏览:643