ste*_*own 8 java android android-styles
使用Android SDK,似乎没有任何方法可以在表格行上设置样式.我想做相同的:
<TableRow
style='@style/TableRow_classic' >
Run Code Online (Sandbox Code Playgroud)
在代码中.我想要像:
TableRow row = new TableRow(this);
row.setStyle(R.style.TableRow_classic);
Run Code Online (Sandbox Code Playgroud)
有谁知道如何找到这个?
Jim*_*rts 13
我发现实现这一目标的最佳解决方案是创建一个表示表行的"部分"布局,并定义一个样式:
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/tr_withborder" />
Run Code Online (Sandbox Code Playgroud)
然后在代码中充气,动态使用:
TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.partial_table_row, null);
Run Code Online (Sandbox Code Playgroud)
虽然不理想,但它对我有用
| 归档时间: |
|
| 查看次数: |
15292 次 |
| 最近记录: |