我在listview中使用微调器,但它在listview中无法正常工作。我能够在微调器中显示所需的值,但无法从微调器中获取项目选择的值。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="10dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView2"
android:layout_marginLeft="5dp"
android:layout_toEndOf="@+id/imageView2"
android:layout_toRightOf="@+id/imageView2"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="@+id/textView15"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView2"
android:layout_toRightOf="@+id/imageView2"
android:src="@drawable/unisex" />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignBottom="@+id/imageView3"
android:layout_toEndOf="@+id/imageView3"
android:layout_toRightOf="@+id/imageView3"
android:gravity="center"
android:paddingLeft="5dp"
android:textColor="@color/black" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="@+id/imageView3"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/imageView2"
android:layout_toRightOf="@+id/imageView2"
android:src="@drawable/location" />
<TextView
android:id="@+id/textView17"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignBottom="@+id/imageView4"
android:layout_toEndOf="@+id/imageView4"
android:layout_toRightOf="@+id/imageView4"
android:gravity="center"
android:paddingLeft="5dp"
android:textColor="@color/black" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="@+id/imageView4"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/imageView2"
android:layout_toRightOf="@+id/imageView2"
android:src="@drawable/location" />
<TextView
android:id="@+id/textView18"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/imageView5"
android:layout_marginRight="20dp"
android:layout_toEndOf="@+id/imageView5"
android:layout_toRightOf="@+id/imageView5"
android:paddingLeft="5dp"
android:textColor="@color/black" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="@+id/textView18"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_toEndOf="@+id/imageView2"
android:layout_toRightOf="@+id/imageView2"
android:src="@drawable/person" />
<TextView
android:id="@+id/textView19"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignBottom="@+id/imageView6"
android:layout_toEndOf="@+id/imageView6"
android:layout_toRightOf="@+id/imageView6"
android:gravity="center"
android:paddingLeft="5dp"
android:textColor="@color/black" />
<TextView
android:id="@+id/textView20"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="@+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:textColor="@color/colorPrimary"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:scaleType="fitXY" />
<Spinner
android:id="@+id/spinner5"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/textView20"
android:layout_toRightOf="@+id/textView20"
android:background="@drawable/primary_square_edittext" />
<Button
android:id="@+id/button13"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_alignLeft="@+id/textView20"
android:layout_alignStart="@+id/textView20"
android:layout_below="@+id/textView20"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:background="@drawable/login_btn_gradient"
android:text="@string/add_cart"
android:textAllCaps="false"
android:textColor="@color/white" />
<Button
android:id="@+id/button14"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_alignEnd="@+id/spinner5"
android:layout_alignRight="@+id/spinner5"
android:layout_alignTop="@+id/button13"
android:background="@drawable/login_btn_gradient"
android:text="@string/view_detail"
android:textAllCaps="false"
android:textColor="@color/white" />
</RelativeLayout>
它不打印任何东西。 布局:
id | cr_date
-----------------------
1| 2017-03-17 11:12:00
----------------------
2|2017-03-17 15:10:00
答案 0 :(得分:0)
好的,我的旋转器代码看看它
final List<governatemodel> Go_data = governat_data[0].getAllGovernante();
final String[] governate_final_data = new String[Go_data.size()];
for (int i = 0 ; i<Go_data.size() ; i++)
{
governate_final_data[i] = Go_data.get(i).getName();
}
final ArrayAdapter<CharSequence> langAdapter2 = new ArrayAdapter<CharSequence>(IntoductionActivity.this, R.layout.spinner_text, governate_final_data );
langAdapter2.setDropDownViewResource(R.layout.simple_spinner_dropdown);
governate_Spinner.setAdapter(langAdapter2);
governate_Spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position != 0)
{
governate_id_value = Go_data.get(position).getId();
String xx = Go_data.get(position).getName()+" ID is " + Go_data.get(position).getId();
Toast.makeText(IntoductionActivity.this, xx, Toast.LENGTH_SHORT).show();
}
else
{
governate_id_value = 0;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
答案 1 :(得分:0)
GET /<logstash-{now/d}>,<logstash-{now/d-1d}>,<logstash-{now/d-2d}>,...
......
there will be 365 items for each day
......
/_search
使用getSelecteditem()方法获取所选项目