- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个具有项目 ListView 的 Android 应用程序。这些 ListView 记录是从 sqlite 数据库中查询的。下面是 ListView 的实现代码:
DataBaseHelper myDbHelper = new DataBaseHelper(null);
myDbHelper = new DataBaseHelper(this);
private static final String fields[] = {"c"};
int[] names = new int[] {R.id.name};
client1 = (ListView)findViewById(R.id.list1 );
String sql = "SELECT sno,a,b,c,d FROM (SELECT com.sno, com.a, com.b com.c,cd.d from table1 mem inner join table2 cd on mem.e=cd.e inner join table3 com on com.b = mem.b where mem.e =14445 AND a is NULL UNION SELECT com.sno, com.a, com.b,com.c,cd.d from table1 mem inner join table3 com on com.b = mem.b inner join table2 cd on mem.e=cd.e where mem.e =14445 AND a is NOT NULL) a group by a,b;";
Cursor cdata = myDbHelper.getView(sql);
SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,R.layout.list1, cdata, fields,names );
client1.setAdapter(adapter2);
其中 list1.xml 是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/MainLayout"
android:padding="5px">
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="#104082"
android:textStyle="bold"
android:layout_weight="1"
/>
</LinearLayout>
这里我的问题是通过更改 ListView 项的文本样式来区分同一 list1.xml 中具有 'a'=null 和 'a'=notnull 的数据记录...... 我可以通过在查询中提供任何文本样式属性来区分 SQL 查询中的文本样式吗?
请帮助我提供示例代码/链接......提前致谢
最佳答案
您可以使用 ListView 的 CustomAdapter 来完成此操作。由于 View 是从包含所有光标结果的自定义数据对象创建的。您可以检查 a 是否为空并且 TextView 具有不同的文本样式
检查this自定义适配器的练习
关于java - Android - 更改ListView项目的TextStyle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8223403/
我在处理我的 flutter 应用程序时遇到了这个空安全错误。 The argument type 'TextStyle?' can't be assigned to the parameter ty
Java 8 DateTimeFormatter 从类似 d 的模式创建。 MMM u 只能解析以 TextStyle.SHORT(例如 13.Feb 2015)定义的样式书写的月份日期,这是一个从
我正在创建一个 MSI 包,我需要将 CheckBox 控件的文本设置为“这是我的 粗体 部分”之类的内容。 我尝试了类似的东西: this is my {\WixUI_Font_Bold}bold
我想连接两个 TextStyle,例如 react 或 react-native。 style={[styles.firstStyle, styles.secondStyle]} 但我不知道如
我是新来的 flutter我需要帮助。 我正在创建一个应用程序,用户可以在其中通过 CupertinoPicker 选择数据. 选择器工作正常,但我想改变它的风格。 目前的风格是that ,但我希望它
我想制作一个自定义小部件,它基本上通过获取一个文本来为文本添加笔划,将其包装在一个包含两个文本的 Stack 中,其中一个用笔划渲染。 class BorderedText extends State
如何定义一小组自定义 TextStyle,然后可以在整个应用程序中重复使用。自定义 TextStyles 应基于 Theme 中定义的 TextStyles。 我知道如何创建单独的 TextStyle
下面是我正在使用的 XML,当我使用 android:textStyle="italic"属性时,文本没有显示。基本上任何具有 SummarySubtitle 样式的 TextView 都不会显示。
有没有办法以编程方式设置 TextView 的 textStyle 属性?似乎没有 setTextStyle() 方法。 要清楚,我不是在谈论 View/Widget 样式!我说的是以下内容: 最佳
我正在使用 core plot 。当我尝试自定义 CPTTextStyle.color 的值时,我发现它是只读的!谁能告诉我如何更改颜色属性的值? 最佳答案 使用 CPTMutableTextStyl
我在应用程序中使用 TextStyles 来支持动态字体。我面临更改每个 TextStyle 的字体的挑战。例如,TextStyle.body 应该是 MyAwesomeBODYFont,TextSt
我想在 Android 中使用 If-Else ValueCombiner 绑定(bind) TextView 的 TextStyle 属性。我尝试了以下方法,但未能创建绑定(bind): 我用 T
我在 ViewPager 中使用 PagerTabStrip 来显示每个页面的标题。这是我的 XML 代码: 我想在 PagerTabStrip 中将 textSty
我有一个 Stepper我正在尝试将 Step(黄色圆圈)小部件(即:1、2、3)内的颜色和 textStyle 从白色更改为黑色。这是我的代码: Theme( data:
我有一个 TextStyle 和一个可以是 true 或 false 的变量 textBold。 if在这个TextStyle中如何实现? TextStyle( color: Colors.w
我为 elevatedButtonTheme 定义了一个 textStyle elevatedButtonTheme: ElevatedButtonThemeData( style: Button
当某个 bool 变量为真时,我的一个可组合项中的文本被删除线。如何在重组时为 TextStyle 中的这种变化设置动画,以便该行淡入而不是突然出现和消失? @Composable fun MyCom
我希望有条件地在我的布局文件中设置 TextView 的 textStyle 属性。直接设置“正常”或“斜体”可以正常工作,但我将如何根据数据绑定(bind)中的一些 bool 值应用这两者之一?
当某个 bool 变量为真时,我的一个可组合项中的文本被删除线。如何在重组时为 TextStyle 中的这种变化设置动画,以便该行淡入而不是突然出现和消失? @Composable fun MyCom
我在使用 C++ 方法设置标签的 TextStyle 时遇到问题,它总是导致应用程序崩溃。 我有一个 C++ getStyle() 方法。我希望能够像这样调用它(删除参数以简化代码示例): Label
我是一名优秀的程序员,十分优秀!