TextView
我的应用程序中有一个.我想将其中的文本对齐到右边.我尝试添加:
android:gravity="right"
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用.
我可能做错了什么?
我是新手php
,我已执行下面的代码.
<?php
class my_class{
var $my_value = array();
function my_class ($value){
$this->my_value[] = $value;
}
function set_value ($value){
// Error occurred from here as Undefined variable: my_value
$this->$my_value = $value;
}
}
$a = new my_class ('a');
$a->my_value[] = 'b';
$a->set_value ('c');
$a->my_class('d');
foreach ($a->my_value as &$value) {
echo $value;
}
?>
Run Code Online (Sandbox Code Playgroud)
我得到了以下错误.可能是什么错误?
Notice: Undefined variable: my_value in C:\xampp\htdocs\MyTestPages\f.php on line 15
Fatal error: Cannot access empty property in C:\xampp\htdocs\MyTestPages\f.php on line 15
Run Code Online (Sandbox Code Playgroud) 我在下面ObservableCollection<string>
.我需要进行排序按字母顺序这一点.
private ObservableCollection<string> _animals = new ObservableCollection<string>
{
"Cat", "Dog", "Bear", "Lion", "Mouse",
"Horse", "Rat", "Elephant", "Kangaroo", "Lizard",
"Snake", "Frog", "Fish", "Butterfly", "Human",
"Cow", "Bumble Bee"
};
Run Code Online (Sandbox Code Playgroud)
我试过了_animals.OrderByDescending
.但我不知道如何正确使用它.
_animals.OrderByDescending(a => a.<what_is_here_?>);
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我正在尝试将数据从我绑定SQLiteDatabase
到ListView
.我现在用的SimpleCursorAdapter
是填写我的ListView
.不幸的是,这似乎不适用于设置CheckBox的checked属性.
这就是我现在这样做的方式; 而不是更改CheckBox的检查状态,适配器正在填充text参数的值,因此该值显示在CheckBox右侧作为文本.
Java的:
setListAdapter( new SimpleCursorAdapter( this,
R.layout.mylist,
data,
new String[] { Datenbank.DB_STATE, Datenbank.DB_NAME },
new int[] { R.id.list_checkbox, R.id.list_text }
) );
Run Code Online (Sandbox Code Playgroud)
mylist.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<CheckBox android:text=""
android:id="@+id/list_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
></CheckBox>
<TextView android:text=""
android:id="@+id/list_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
编辑:数据库中的字段当然是boolean类型的,我也尝试将id分配给checked字段以填充值.
我使用下面的代码,它不是渲染图形布局.显示错误为Exception raised during rendering: No tab known for tag null
.
我怎么能解决这个问题?
<android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
Run Code Online (Sandbox Code Playgroud) 下面是我的测试代码,用于创建列表视图,列表视图显示成功,但是,点击事件中存在错误.我想创建一个向新活动发送硬编码消息的意图.但是,它显示该行的错误
Intent intent = new Intent(context, SendMessage.class);
Run Code Online (Sandbox Code Playgroud)
所以问题是,我应该为这门课提供什么?
另外,输出消息代替硬编码,如何捕获列表视图行中的数据并传递给新活动?例如BBB,AAA,R.drawable.tab1_hdpi
,对于第一行.
谢谢.
public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.ListViewTest.MESSAGE";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ArrayList<ListEntry> members = new ArrayList<ListEntry>();
members.add(new ListEntry("BBB","AAA",R.drawable.tab1_hdpi));
members.add(new ListEntry("ccc","ddd",R.drawable.tab2_hdpi));
members.add(new ListEntry("assa","cxv",R.drawable.tab3_hdpi));
members.add(new ListEntry("BcxsadvBB","AcxdxvAA"));
members.add(new ListEntry("BcxvadsBB","AcxzvAA"));
members.add(new ListEntry("BcxvBB","AcxvAA"));
members.add(new ListEntry("BvBB","AcxsvAA"));
members.add(new ListEntry("BcxvBB","AcxsvzAA"));
members.add(new ListEntry("Bcxadv","AcsxvAA"));
members.add(new ListEntry("BcxcxB","AcxsvAA"));
ListView lv = (ListView)findViewById(R.id.listView1);
Log.i("testTag","before start adapter");
StringArrayAdapter ad = new StringArrayAdapter (members,this);
Log.i("testTag","after start adapter");
Log.i("testTag","set adapter");
lv.setAdapter(ad);
lv.setOnItemClickListener(new OnItemClickListener() { …
Run Code Online (Sandbox Code Playgroud) android listview android-intent onitemclicklistener onitemclick
当我尝试INSERT
在oracle中执行语句时,我收到SQL Error: ORA-00917: missing comma
错误,因为Alex's Tea Factory
我的INSERT
语句中有一个值.
我怎么能逃脱'
?
我们如何将主报表中的参数传递给Crystal Reports XI中的子报表?我在主报告中有一个参数.现在,我想将相同的参数传递给子报告.请帮我.