硕士详细机器人拆造型 [英] Master detail split styling in android

查看:161
本文介绍了硕士详细机器人拆造型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能已经被问了很多次在这里,没有得到有用的答案。我想在这里把它与一个可能的答案。随意提高。

问:如何设置弹出类似的细节视图风格,在并排大师细节图,如下图所强调的:

Question: How to setup popup like style of detail view, in side by side master detail view as highlighted in image below:

推荐答案

在这个解决方案中,我使用的9补丁背景图像,确定2种背景的列表项。因此,选择(选中)列表项目都有不同的背景,如下所示:

In this solution , I have used 9-patch background images, to define 2 kinds of backgrounds for list items. So, the selected(checked) list Item has a different background, as shown:

(列表项)

(list item)

(选择项)

(selected item)

(列表项)

(list item)

列表项布局的父视图,是一类延伸的LinearLayout (可以是任何的ViewGroup )和实施可检查。因此,当的ListView 设置为选择模式,它可以自动检查/取消这一观点。这选中状态,然后使用选择分配给这种观点的背景:

The list item layout's parent view, is a class extending LinearLayout (can be any ViewGroup) and implementing Checkable. Hence, when ListView is set to choice mode, it can automatically check/uncheck this view. This checked state is then used by selector background assigned to this view :

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_checked="true" android:drawable="@drawable/checked"/>
  <item android:drawable="@drawable/unchecked"/>
</selector>

这会自动列表项目视图变化的背景下,而无需在code列表项中选择,每次做手工。

This makes the background of list item view change automatically, without having to do it manually in code every time a list item is selected.

结果:

查看源文件code

其他几点:

  1. 滚动条可以移动到左侧。
  2. 匹配阴影颜色,或更多的填充的
  3. 使用列表分隔可放置列表项和细节视图之间。
  1. Scrollbar can be moved to left side.
  2. Use list dividers that match shadow color, or more padding can be placed between list items and detail view.

这篇关于硕士详细机器人拆造型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆