Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于列表视图中每个单元格的 dp 大小,是否有任何建议。(假设列表视图只有一行文本)?
谢谢, 泰加
如果“每个单元格有多大”表示行高,那么
android:layout_height="?android:attr/listPreferredItemHeight"
应该有帮助
除了塞尔文的回答。
如果你想从源代码中获得它:
R.attr.listPreferredItemHeight
通过代码:
R.attr.listPreferredItemHeight 只是资源 id 而不是值。
这有效:Android:如何在代码中获取“listPreferredItemHeight”属性的值?