Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Layout Android材质波纹布局阵列适配器setonitemclicklistener不工作_Layout_Android Arrayadapter - Fatal编程技术网

Layout Android材质波纹布局阵列适配器setonitemclicklistener不工作

Layout Android材质波纹布局阵列适配器setonitemclicklistener不工作,layout,android-arrayadapter,Layout,Android Arrayadapter,我将这个库导入到我的android项目中。”com.balysv:材质波纹:1.0.1' 我想在listview中使用。ripple工作正常,但当我触摸listview SetInItemClickListener时,它不工作。这是我的密码 public class Jobs extends Activity { ListView listOfJobs; LinearLayout llBack; //boolean[] bolSubGroup = {false,false,false,true

我将这个库导入到我的android项目中。”com.balysv:材质波纹:1.0.1' 我想在listview中使用。ripple工作正常,但当我触摸listview SetInItemClickListener时,它不工作。这是我的密码

public class Jobs extends Activity {

ListView listOfJobs;
LinearLayout llBack;
//boolean[] bolSubGroup = {false,false,false,true,false,true,false,true,true,false,false,false,true};
ArrayList<String> lstID = new ArrayList<String>();
ArrayList<String> lstTitle = new ArrayList<String>();
ArrayList<Integer> lstSubggroup = new ArrayList<Integer>();
 String [] strTitle;
 Integer [] intSubgroup ;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.jobs);
    ListJobs();
     strTitle = new String[lstTitle.size()];
     intSubgroup = new Integer[lstSubggroup.size()];


    lstTitle.toArray(strTitle);
    lstSubggroup.toArray(intSubgroup);
    listOfJobs = (ListView) findViewById(R.id.lstv_Jobs);
    LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(Jobs.this,
            R.animator.in_from_right2), 0.8f); //0.5f == time between appearance of listview item
    listOfJobs.setLayoutAnimation(lac);
    listOfJobs.setAdapter(new JobsAdapter1(this, R.layout.jobs_single_row,
            R.id.txv_Jobs_SR, R.id.img_Jobs_SR, strTitle, intSubgroup));
    listOfJobs.setOnItemClickListener(this);

    llBack = (LinearLayout) findViewById(R.id.lil_Jobs_Top);
    llBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            vibe.vibrate(20);
            finish();
        }
    });






    listOfJobs.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

    });//*/
}
我的单行xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent">


<com.balysv.materialripple.MaterialRippleLayout
    android:id="@+id/ripple"
    android:layout_width="match_parent"
    app:mrl_rippleColor="@color/yellow_ShahreHarah"
    app:mrl_rippleOverlay="true"
    app:mrl_rippleDimension="10dp"
    app:mrl_rippleAlpha="0.2"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    app:mrl_rippleHover="true"
    android:layout_height="wrap_content">
<RelativeLayout
    android:layout_width="fill_parent"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:layout_height="fill_parent">
<ImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    android:layout_margin="10dp"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:src="@drawable/arrows_in"
    android:id="@+id/img_Jobs_SR"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:textAppearance="?android:attr/textAppearanceListItem"
    android:text="Large Text"
    android:textDirection="rtl"
    android:maxLines="1"
    android:id="@+id/txv_Jobs_SR"
    android:gravity="right"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_marginRight="10dp"
    android:layout_marginTop="19dp"
    android:layout_marginBottom="10dp"
    android:layout_toRightOf="@+id/img_Jobs_SR"
    android:layout_toEndOf="@+id/img_Jobs_SR" />

</RelativeLayout>

</com.balysv.materialripple.MaterialRippleLayout>

这是我的主要xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="match_parent">

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:background="@color/yellow_ShahreHarah"
    android:id="@+id/lil_Jobs_Top"
    android:layout_height="50dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ImageView
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_centerVertical="true"
            android:layout_alignParentLeft="true"
            android:src="@drawable/arrows_in"
            android:id="@+id/img_Jobs_Top" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="20dp"
            android:textDirection="rtl"
            android:textSize="20sp"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="گروه های شغلی"
            android:id="@+id/textView2" />
        </RelativeLayout>

</LinearLayout>

<View
    android:layout_width="fill_parent"
    android:layout_height="4dp"
    android:background="@drawable/shadow_left"
    android:layout_alignParentTop="true"/>

<ListView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="none"
    android:clickable="true"
    android:id="@+id/lstv_Jobs" />

****************答复***** 我找到了答案

在单行xml文件中,您必须这样编写

<com.balysv.materialripple.MaterialRippleLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables"
app:mrl_rippleColor="#5b9bd5"
app:mrl_rippleOverlay="true"
app:mrl_rippleDimension="10dp"
app:mrl_rippleAlpha="0.2"
app:mrl_rippleHover="true"
app:mrl_rippleDelayClick="true"
android:background="#00deeaf6"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
    android:id="@+id/lil_PIP_SR"
    android:background="#00deeaf6"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_weight="1"
        android:paddingTop="15dp"
        android:paddingBottom="15dp"
        android:layout_width="10dp"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="30dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:src="@drawable/phone_home"
            android:id="@+id/img_PIP_HM_sr"
            android:layout_height="30dp" />
    </RelativeLayout>
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>

在您的
com.balysv.materialripple.MaterialRippleLayout
中尝试设置
应用程序:mrl\u rippleInAdapter=“true”
。它对我有用

<com.balysv.materialripple.MaterialRippleLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables"
app:mrl_rippleColor="#5b9bd5"
app:mrl_rippleOverlay="true"
app:mrl_rippleDimension="10dp"
app:mrl_rippleAlpha="0.2"
app:mrl_rippleHover="true"
app:mrl_rippleDelayClick="true"
android:background="#00deeaf6"
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
    android:id="@+id/lil_PIP_SR"
    android:background="#00deeaf6"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_weight="1"
        android:paddingTop="15dp"
        android:paddingBottom="15dp"
        android:layout_width="10dp"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="30dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:src="@drawable/phone_home"
            android:id="@+id/img_PIP_HM_sr"
            android:layout_height="30dp" />
    </RelativeLayout>
</LinearLayout>
</com.balysv.materialripple.MaterialRippleLayout>