问:
ListView inside ScrollView is not scrolling on Android
I am having trouble with a scrolling ListView inside a ScrollView. I have an Activity which has some EditTexts in the top part and then a tab host with two tabs which have one ListView each. When the EditText views are focused, the soft keyboard comes up and as I  have a ScrollView, the content is scrollable. But the problem comes when there are more items in ListViews (ones in tabs), I am not able to scroll the ListView, even if there are more items.

The following is the layout XML:

```<code><?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="?backgroundImage"
    android:orientation="vertical">

  <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_alignParentBottom="true"
        android:layout_margin="10dip"
        android:id="@+id/buttons">
    <Button
            android:text="Save"
            android:layout_margin="2dip"
            android:textSize="20dip"
            android:id="@+id/btnSaveorUpdate"
            android:layout_height="wrap_content"
            android:layout_width="145dip"></Button>
    <Button
            android:text="Cancel"
            android:layout_margin="2dip"
            android:textSize="20dip"
            android:id="@+id/btnCancelorDelete"
            android:layout_height="wrap_content"
            android:layout_width="145dip"></Button>
  </LinearLayout>
  <ScrollView
        android:layout_above="@id/buttons"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"
        android:layout_margin="10dip">
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dip">
      <TextView
                android:text="Bill details"
                android:textColor="?textColorDark"
                android:layout_alignParentTop="true"
                android:id="@+id/txtEnterDetails"
                android:textSize="25dip"
                android:textStyle="bold"
                android:layout_height="wrap_content"
                android:layout_width="fill_parent"
                android:layout_marginBottom="2dip"></TextView>
      <LinearLayout
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:layout_width="0dip"
                android:layout_height="0dip" />
      <EditText
                android:layout_width="fill_parent"
                android:hint="Enter data"
                android:inputType="numberDecimal"
                android:id="@+id/txtSample"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:text=""></EditText>
      <EditText
                android:layout_width="fill_parent"
                android:id="@+id/txtDescription"
                android:hint="Enter description"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:inputType="text"
                android:text=""></EditText>
      <EditText
                android:layout_width="fill_parent"
                android:id="@+id/txtComment"
                android:hint="Enter comment (if any)"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:inputType="text"
                android:text=""></EditText>
      <LinearLayout
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
        <TextView
                    android:id="@+id/txtDate"
                    android:layout_width="wrap_content"
                    android:text=""
                    android:textSize="20dip"
                    android:textColor="?textColorDark"
                    android:layout_marginLeft="10dip"
                    android:layout_height="@dimen/editTextHeight"
                    android:layout_gravity="center_vertical" />
        <Button
                    android:id="@+id/btnPickDate"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/editTextHeight"
                    android:text="Select date"
                    android:layout_margin="2dip"
                    android:textSize="15dip"
                    android:layout_gravity="center_vertical" />
      </LinearLayout>
      <TabHost
                android:id="@+id/tabhost"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
        <LinearLayout
                    android:id="@+id/linearLayout1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical">
          <TabWidget
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@android:id/tabs"></TabWidget>
          <FrameLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:id="@android:id/tabcontent">
            <ScrollView
                            android:layout_above="@id/buttons"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"
                            android:fillViewport="true"
                            android:id="@+id/tab1">
              <LinearLayout
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">
                <TableLayout
                                    android:layout_height="wrap_content"
                                    android:layout_width="fill_parent">
                  <TableRow
                                        android:id="@+id/tableRow1"
                                        android:layout_marginLeft="2dip"
                                        android:layout_marginRight="5dip"
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content">
                    <LinearLayout
                                            android:layout_width="fill_parent"
                                            android:layout_height="wrap_content"
                                            android:orientation="horizontal">
                      <ImageView
                                                android:src="@drawable/ic_menu_invite"
                                                android:layout_width="40dip"
                                                android:layout_height="40dip"
                                                android:layout_gravity="center_vertical"></ImageView>
                      <TextView
                                                android:text="Add friend"
                                                android:layout_height="wrap_content"
                                                android:layout_width="fill_parent"
                                                android:layout_centerVertical="true"
                                                android:textColor="?textColorDark"
                                                android:textSize="@dimen/editText"
                                                android:layout_gravity="center_vertical" />
                    </LinearLayout>
                  </TableRow>
                  <TableRow
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="5dip"
                                        android:layout_marginRight="5dip">
                    <TextView
                                            android:id="@+id/txtData1"
                                            android:layout_width="170dip"
                                            android:layout_height="wrap_content"
                                            android:text="Data"
                                            android:textSize="14dip"
                                            android:textStyle="bold"
                                            android:textColor="#000000">
                    </TextView>
                    <TextView
                                            android:id="@+id/txtData2"
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:text="Sample"
                                            android:textSize="13dip"
                                            android:textColor="#000000"></TextView>

                  </TableRow>
                </TableLayout>
                <ListView
                                    android:cacheColorHint="#00000000"
                                    android:id="@+id/ListView01"
                                    android:layout_height="wrap_content"
                                    android:layout_width="fill_parent" />
              </LinearLayout>
            </ScrollView>
            <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center_horizontal"
                            android:id="@+id/tab2"
                            android:orientation="vertical">
              <TableLayout
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent">
                <TableRow
                                    android:id="@+id/tableRow2"
                                    android:layout_marginLeft="2dip"
                                    android:layout_marginRight="5dip"
                                    android:layout_width="fill_parent"
                                    android:layout_height="wrap_content">
                  <LinearLayout
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content"
                                        android:orientation="horizontal">
                    <ImageView
                                            android:src="@drawable/ic_menu_invite"
                                            android:layout_width="40dip"
                                            android:layout_height="40dip"
                                            android:layout_gravity="center_vertical"></ImageView>
                    <TextView
                                            android:text="Sample"
                                            android:layout_height="wrap_content"
                                            android:layout_width="fill_parent"
                                            android:layout_centerVertical="true"
                                            android:textColor="?textColorDark"
                                            android:textSize="@dimen/editText"
                                            android:layout_gravity="center_vertical" />
                  </LinearLayout>
                </TableRow>
                <TableRow
                                    android:layout_width="fill_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginLeft="5dip"
                                    android:layout_marginRight="5dip">
                  <TextView
                                        android:id="@+id/txtUser1"
                                        android:layout_width="170dip"
                                        android:layout_height="wrap_content"
                                        android:text="User"
                                        android:textSize="14dip"
                                        android:textStyle="bold"
                                        android:textColor="#000000">
                  </TextView>
                  <TextView
                                        android:id="@+id/txtUserData"
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:text="UserData"
                                        android:textSize="13dip"
                                        android:textColor="#000000"></TextView>
                </TableRow>
              </TableLayout>

              <ListView
                                android:cacheColorHint="#00000000"
                                android:id="@+id/ListView02"
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent" />

            </LinearLayout>

          </FrameLayout>
        </LinearLayout>
      </TabHost>
    </LinearLayout>
  </ScrollView>
</RelativeLayout>
</code>```

Please can anyone tell me what the problem is here? I have another post on the ListView inside ScrollView problem, but they were of no use in my case.

答:
I have tried and tested nearly all the methods mentioned above, trust me, after completely running away from RecyclerView, I replaced my ListView with RecyclerView and it worked perfectly. Didnt need any 3rd Party library for ExtendedHeightListView and all, just plain and simple RecyclerView.

So Heres my Layout file before recyclerView:

```<code><?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="5dp">

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativeLayoutre"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    tools:context="com.example.android.udamovappv3.activities.DetailedActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar_detail"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="top"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <TextView
        android:id="@+id/title_name"
        android:layout_width="fill_parent"
        android:layout_height="128dp"
        android:layout_alignParentStart="true"
        android:layout_marginTop="59dp"
        android:background="#079ED9"
        android:gravity="left|center"
        android:padding="25dp"
        android:text="Name"
        android:textColor="#ffffff"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/my_toolbar_detail"
        app:layout_constraintVertical_bias="0.0"
        tools:layout_editor_absoluteX="0dp" />

    <ImageView
        android:id="@+id/iv_poster"
        android:layout_width="131dp"
        android:layout_height="163dp"
        android:layout_alignStart="@+id/my_toolbar_detail"
        android:layout_below="@+id/title_name"
        android:layout_marginBottom="15dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="15dp"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@mipmap/ic_launcher" />

    <Button
        android:id="@+id/bt_mark_as_fav"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/iv_poster"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="11dp"
        android:layout_marginEnd="50dp"
        android:background="#079ED9"
        android:text="Mark As \n Favorite"
        android:textSize="10dp" />

    <TextView
        android:id="@+id/tv_runTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_rating"
        android:layout_below="@+id/tv_releaseDate"
        android:layout_marginTop="11dp"
        android:text="TextView"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tv_releaseDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_runTime"
        android:layout_alignTop="@+id/iv_poster"
        android:text="TextView"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/tv_rating"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/bt_mark_as_fav"
        android:layout_below="@+id/tv_runTime"
        android:layout_marginTop="11dp"
        android:text="TextView" />

    <TextView
        android:id="@+id/tv_overview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/iv_poster"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="5dp"
        android:foregroundGravity="center"
        android:text="adasdasdfadfsasdfasdfasdfasdfnb agfjuanfalsbdfjbdfklbdnfkjasbnf;kasbdnf;kbdfas;kdjabnf;lbdnfo;aidsnfl';asdfj'plasdfj'pdaskjf'asfj'p[asdfk"
        android:textColor="#000000"
         />

    <RelativeLayout
        android:id="@+id/foodItemActvity_linearLayout_fragments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/tv_overview">
        <TextView
            android:id="@+id/fragment_dds_review_textView_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reviews:"

            android:textAppearance="?android:attr/textAppearanceMedium" />
        <com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/fragment_dds_review_textView_label"
            android:padding="8dp">

        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView>
    </RelativeLayout>
</RelativeLayout>
</ScrollView>
</code>```

THIS IS AFTER REPLACING MY LISTVIEW WITH ONE OF THE MANY SOLUTIONS MENTIONED ABOVE. So the problem was that the listview was not behaving properly due to 2 scrollview bug(maybe not a bug) in android.

I replaced the
with recycler view to form form my final layout.

This is my recycler view adapter:

```<code>public class TrailerAdapter extends RecyclerView.Adapter<TrailerAdapter.TrailerAdapterViewHolder> {

private ArrayList<String> Youtube_URLS;

private Context Context;

public TrailerAdapter(Context context, ArrayList<String> Youtube_URLS){
    this.Context = context;
    this.Youtube_URLS = Youtube_URLS;
}
@Override
public TrailerAdapter.TrailerAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trailer_layout, parent, false);
    return new TrailerAdapterViewHolder(view);
}

@Override
public void onBindViewHolder(TrailerAdapter.TrailerAdapterViewHolder holder, int position) {
    Picasso.with(Context).load(R.drawable.ic_play_arrow_black_24dp).into(holder.iv_playbutton);
    holder.item_id.setText(Youtube_URLS.get(position));
}

@Override
public int getItemCount() {
    if(Youtube_URLS.size()==0){
        return 0;
    }else{
        return Youtube_URLS.size();
    }
}

public class TrailerAdapterViewHolder extends RecyclerView.ViewHolder {
    ImageView iv_playbutton;
    TextView item_id;

    public TrailerAdapterViewHolder(View itemView) {
        super(itemView);
        iv_playbutton = (ImageView)itemView.findViewById(R.id.play_button);
        item_id = (TextView)itemView.findViewById(R.id.tv_trailer_sequence);
    }
}
}
</code>```

And this is my RecyclerView custom layout:

```<code><RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/play_button"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="6dip"
        android:layout_marginStart="12dp"
        android:src="@drawable/ic_play_arrow_black_24dp"
        android:layout_centerVertical="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/tv_trailer_sequence"
        android:layout_width="wrap_content"
        android:layout_height="26dip"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@+id/play_button"
        android:ellipsize="marquee"
        android:gravity="center"
        android:maxLines="1"
        android:text="Description"
        android:textSize="12sp" />

</RelativeLayout>
</code>```

And VOILA, I got the desired effect of ListView(Now RecyclerView) within a scollview.
Heres the Final Image of the UI

On a final note, I believe that replacing the RecyclerView was a better choice for me, as it improved the overall app stability, and also helped me understand RecyclerView better. If I were to suggest a solution, Im going to say replace your ListView with a RecyclerView.

Body:
I am having trouble with a scrolling ListView inside a ScrollView. I have an Activity which has some EditTexts in the top part and then a tab host with two tabs which have one ListView each. When the EditText views are focused, the soft keyboard comes up and as I  have a ScrollView, the content is scrollable. But the problem comes when there are more items in ListViews (ones in tabs), I am not able to scroll the ListView, even if there are more items.

The following is the layout XML:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="?backgroundImage"
    android:orientation="vertical">

  <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_alignParentBottom="true"
        android:layout_margin="10dip"
        android:id="@+id/buttons">
    <Button
            android:text="Save"
            android:layout_margin="2dip"
            android:textSize="20dip"
            android:id="@+id/btnSaveorUpdate"
            android:layout_height="wrap_content"
            android:layout_width="145dip"></Button>
    <Button
            android:text="Cancel"
            android:layout_margin="2dip"
            android:textSize="20dip"
            android:id="@+id/btnCancelorDelete"
            android:layout_height="wrap_content"
            android:layout_width="145dip"></Button>
  </LinearLayout>
  <ScrollView
        android:layout_above="@id/buttons"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"
        android:layout_margin="10dip">
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="10dip">
      <TextView
                android:text="Bill details"
                android:textColor="?textColorDark"
                android:layout_alignParentTop="true"
                android:id="@+id/txtEnterDetails"
                android:textSize="25dip"
                android:textStyle="bold"
                android:layout_height="wrap_content"
                android:layout_width="fill_parent"
                android:layout_marginBottom="2dip"></TextView>
      <LinearLayout
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:layout_width="0dip"
                android:layout_height="0dip" />
      <EditText
                android:layout_width="fill_parent"
                android:hint="Enter data"
                android:inputType="numberDecimal"
                android:id="@+id/txtSample"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:text=""></EditText>
      <EditText
                android:layout_width="fill_parent"
                android:id="@+id/txtDescription"
                android:hint="Enter description"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:inputType="text"
                android:text=""></EditText>
      <EditText
                android:layout_width="fill_parent"
                android:id="@+id/txtComment"
                android:hint="Enter comment (if any)"
                android:textSize="@dimen/editText"
                android:layout_height="@dimen/editTextHeight"
                android:inputType="text"
                android:text=""></EditText>
      <LinearLayout
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
        <TextView
                    android:id="@+id/txtDate"
                    android:layout_width="wrap_content"
                    android:text=""
                    android:textSize="20dip"
                    android:textColor="?textColorDark"
                    android:layout_marginLeft="10dip"
                    android:layout_height="@dimen/editTextHeight"
                    android:layout_gravity="center_vertical" />
        <Button
                    android:id="@+id/btnPickDate"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/editTextHeight"
                    android:text="Select date"
                    android:layout_margin="2dip"
                    android:textSize="15dip"
                    android:layout_gravity="center_vertical" />
      </LinearLayout>
      <TabHost
                android:id="@+id/tabhost"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
        <LinearLayout
                    android:id="@+id/linearLayout1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical">
          <TabWidget
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@android:id/tabs"></TabWidget>
          <FrameLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:id="@android:id/tabcontent">
            <ScrollView
                            android:layout_above="@id/buttons"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"
                            android:fillViewport="true"
                            android:id="@+id/tab1">
              <LinearLayout
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">
                <TableLayout
                                    android:layout_height="wrap_content"
                                    android:layout_width="fill_parent">
                  <TableRow
                                        android:id="@+id/tableRow1"
                                        android:layout_marginLeft="2dip"
                                        android:layout_marginRight="5dip"
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content">
                    <LinearLayout
                                            android:layout_width="fill_parent"
                                            android:layout_height="wrap_content"
                                            android:orientation="horizontal">
                      <ImageView
                                                android:src="@drawable/ic_menu_invite"
                                                android:layout_width="40dip"
                                                android:layout_height="40dip"
                                                android:layout_gravity="center_vertical"></ImageView>
                      <TextView
                                                android:text="Add friend"
                                                android:layout_height="wrap_content"
                                                android:layout_width="fill_parent"
                                                android:layout_centerVertical="true"
                                                android:textColor="?textColorDark"
                                                android:textSize="@dimen/editText"
                                                android:layout_gravity="center_vertical" />
                    </LinearLayout>
                  </TableRow>
                  <TableRow
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="5dip"
                                        android:layout_marginRight="5dip">
                    <TextView
                                            android:id="@+id/txtData1"
                                            android:layout_width="170dip"
                                            android:layout_height="wrap_content"
                                            android:text="Data"
                                            android:textSize="14dip"
                                            android:textStyle="bold"
                                            android:textColor="#000000">
                    </TextView>
                    <TextView
                                            android:id="@+id/txtData2"
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:text="Sample"
                                            android:textSize="13dip"
                                            android:textColor="#000000"></TextView>

                  </TableRow>
                </TableLayout>
                <ListView
                                    android:cacheColorHint="#00000000"
                                    android:id="@+id/ListView01"
                                    android:layout_height="wrap_content"
                                    android:layout_width="fill_parent" />
              </LinearLayout>
            </ScrollView>
            <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center_horizontal"
                            android:id="@+id/tab2"
                            android:orientation="vertical">
              <TableLayout
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent">
                <TableRow
                                    android:id="@+id/tableRow2"
                                    android:layout_marginLeft="2dip"
                                    android:layout_marginRight="5dip"
                                    android:layout_width="fill_parent"
                                    android:layout_height="wrap_content">
                  <LinearLayout
                                        android:layout_width="fill_parent"
                                        android:layout_height="wrap_content"
                                        android:orientation="horizontal">
                    <ImageView
                                            android:src="@drawable/ic_menu_invite"
                                            android:layout_width="40dip"
                                            android:layout_height="40dip"
                                            android:layout_gravity="center_vertical"></ImageView>
                    <TextView
                                            android:text="Sample"
                                            android:layout_height="wrap_content"
                                            android:layout_width="fill_parent"
                                            android:layout_centerVertical="true"
                                            android:textColor="?textColorDark"
                                            android:textSize="@dimen/editText"
                                            android:layout_gravity="center_vertical" />
                  </LinearLayout>
                </TableRow>
                <TableRow
                                    android:layout_width="fill_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginLeft="5dip"
                                    android:layout_marginRight="5dip">
                  <TextView
                                        android:id="@+id/txtUser1"
                                        android:layout_width="170dip"
                                        android:layout_height="wrap_content"
                                        android:text="User"
                                        android:textSize="14dip"
                                        android:textStyle="bold"
                                        android:textColor="#000000">
                  </TextView>
                  <TextView
                                        android:id="@+id/txtUserData"
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:text="UserData"
                                        android:textSize="13dip"
                                        android:textColor="#000000"></TextView>
                </TableRow>
              </TableLayout>

              <ListView
                                android:cacheColorHint="#00000000"
                                android:id="@+id/ListView02"
                                android:layout_height="wrap_content"
                                android:layout_width="fill_parent" />

            </LinearLayout>

          </FrameLayout>
        </LinearLayout>
      </TabHost>
    </LinearLayout>
  </ScrollView>
</RelativeLayout>

Please can anyone tell me what the problem is here? I have another post on the ListView inside ScrollView problem, but they were of no use in my case.

Body:
I have tried and tested nearly all the methods mentioned above, trust me, after completely running away from RecyclerView, I replaced my ListView with RecyclerView and it worked perfectly. Didnt need any 3rd Party library for ExtendedHeightListView and all, just plain and simple RecyclerView.

So Heres my Layout file before recyclerView:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="5dp">

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativeLayoutre"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    tools:context="com.example.android.udamovappv3.activities.DetailedActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar_detail"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="top"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <TextView
        android:id="@+id/title_name"
        android:layout_width="fill_parent"
        android:layout_height="128dp"
        android:layout_alignParentStart="true"
        android:layout_marginTop="59dp"
        android:background="#079ED9"
        android:gravity="left|center"
        android:padding="25dp"
        android:text="Name"
        android:textColor="#ffffff"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/my_toolbar_detail"
        app:layout_constraintVertical_bias="0.0"
        tools:layout_editor_absoluteX="0dp" />

    <ImageView
        android:id="@+id/iv_poster"
        android:layout_width="131dp"
        android:layout_height="163dp"
        android:layout_alignStart="@+id/my_toolbar_detail"
        android:layout_below="@+id/title_name"
        android:layout_marginBottom="15dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="15dp"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@mipmap/ic_launcher" />

    <Button
        android:id="@+id/bt_mark_as_fav"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/iv_poster"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="11dp"
        android:layout_marginEnd="50dp"
        android:background="#079ED9"
        android:text="Mark As \n Favorite"
        android:textSize="10dp" />

    <TextView
        android:id="@+id/tv_runTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_rating"
        android:layout_below="@+id/tv_releaseDate"
        android:layout_marginTop="11dp"
        android:text="TextView"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tv_releaseDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_runTime"
        android:layout_alignTop="@+id/iv_poster"
        android:text="TextView"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/tv_rating"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/bt_mark_as_fav"
        android:layout_below="@+id/tv_runTime"
        android:layout_marginTop="11dp"
        android:text="TextView" />

    <TextView
        android:id="@+id/tv_overview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/iv_poster"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="5dp"
        android:foregroundGravity="center"
        android:text="adasdasdfadfsasdfasdfasdfasdfnb agfjuanfalsbdfjbdfklbdnfkjasbnf;kasbdnf;kbdfas;kdjabnf;lbdnfo;aidsnfl';asdfj'plasdfj'pdaskjf'asfj'p[asdfk"
        android:textColor="#000000"
         />

    <RelativeLayout
        android:id="@+id/foodItemActvity_linearLayout_fragments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/tv_overview">
        <TextView
            android:id="@+id/fragment_dds_review_textView_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reviews:"

            android:textAppearance="?android:attr/textAppearanceMedium" />
        <com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/fragment_dds_review_textView_label"
            android:padding="8dp">

        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView>
    </RelativeLayout>
</RelativeLayout>
</ScrollView>

THIS IS AFTER REPLACING MY LISTVIEW WITH ONE OF THE MANY SOLUTIONS MENTIONED ABOVE. So the problem was that the listview was not behaving properly due to 2 scrollview bug(maybe not a bug) in android.

I replaced the
with recycler view to form form my final layout.

This is my recycler view adapter:

public class TrailerAdapter extends RecyclerView.Adapter<TrailerAdapter.TrailerAdapterViewHolder> {

private ArrayList<String> Youtube_URLS;

private Context Context;

public TrailerAdapter(Context context, ArrayList<String> Youtube_URLS){
    this.Context = context;
    this.Youtube_URLS = Youtube_URLS;
}
@Override
public TrailerAdapter.TrailerAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trailer_layout, parent, false);
    return new TrailerAdapterViewHolder(view);
}

@Override
public void onBindViewHolder(TrailerAdapter.TrailerAdapterViewHolder holder, int position) {
    Picasso.with(Context).load(R.drawable.ic_play_arrow_black_24dp).into(holder.iv_playbutton);
    holder.item_id.setText(Youtube_URLS.get(position));
}

@Override
public int getItemCount() {
    if(Youtube_URLS.size()==0){
        return 0;
    }else{
        return Youtube_URLS.size();
    }
}

public class TrailerAdapterViewHolder extends RecyclerView.ViewHolder {
    ImageView iv_playbutton;
    TextView item_id;

    public TrailerAdapterViewHolder(View itemView) {
        super(itemView);
        iv_playbutton = (ImageView)itemView.findViewById(R.id.play_button);
        item_id = (TextView)itemView.findViewById(R.id.tv_trailer_sequence);
    }
}
}

And this is my RecyclerView custom layout:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/play_button"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="6dip"
        android:layout_marginStart="12dp"
        android:src="@drawable/ic_play_arrow_black_24dp"
        android:layout_centerVertical="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/tv_trailer_sequence"
        android:layout_width="wrap_content"
        android:layout_height="26dip"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@+id/play_button"
        android:ellipsize="marquee"
        android:gravity="center"
        android:maxLines="1"
        android:text="Description"
        android:textSize="12sp" />

</RelativeLayout>

And VOILA, I got the desired effect of ListView(Now RecyclerView) within a scollview.
Heres the Final Image of the UI

On a final note, I believe that replacing the RecyclerView was a better choice for me, as it improved the overall app stability, and also helped me understand RecyclerView better. If I were to suggest a solution, Im going to say replace your ListView with a RecyclerView.


来源: stackexchange

问:
Maven Build Plugin doesn't include my own classes
I have the following (very) simple pom.xml:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ro.ace.ucv</groupId>
    <artifactId>message_generator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <scala.major.version>2.10</scala.major.version>
        <scala.version>${scala.major.version}.5</scala.version>
        <spark.version>1.6.0</spark.version>
        <spark.streaming.version>1.6.0</spark.streaming.version>
        <spark.sql.version>1.6.0</spark.sql.version>
        <spark.version>1.6.0</spark.version>
        <junit.version>4.12</junit.version>
        <scalatest.version>2.1.3</scalatest.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>${spark.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.11</artifactId>
            <version>0.10.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.message.generator.MessageGeneratorMain</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
</code>```

and the following (very) simple project structure:

\message_generator\src\main\scala\com\message\generator\MessageGeneratorMain.scala

When running mvn clean compile assembly:single

I get a jar with dependencies, but my own code (3 classes, including the Main one) is not included in the final jar.

答:
You must include the Maven Scala plugin to catch the scala code in src/main/scala</p>

```<code><build>
    <plugins>
        <plugin>
            <groupId>org.scala-tools</groupId>
           <artifactId>maven-scala-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have the following (very) simple pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ro.ace.ucv</groupId>
    <artifactId>message_generator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <scala.major.version>2.10</scala.major.version>
        <scala.version>${scala.major.version}.5</scala.version>
        <spark.version>1.6.0</spark.version>
        <spark.streaming.version>1.6.0</spark.streaming.version>
        <spark.sql.version>1.6.0</spark.sql.version>
        <spark.version>1.6.0</spark.version>
        <junit.version>4.12</junit.version>
        <scalatest.version>2.1.3</scalatest.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>${spark.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.11</artifactId>
            <version>0.10.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.message.generator.MessageGeneratorMain</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

and the following (very) simple project structure:

\message_generator\src\main\scala\com\message\generator\MessageGeneratorMain.scala

When running mvn clean compile assembly:single

I get a jar with dependencies, but my own code (3 classes, including the Main one) is not included in the final jar.

Body:
You must include the Maven Scala plugin to catch the scala code in src/main/scala

<build>
    <plugins>
        <plugin>
            <groupId>org.scala-tools</groupId>
           <artifactId>maven-scala-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>


问:
How to use @DbRef with a map having list as value in java?
This is what I am trying to do and it is not working.</p>

```<code>@DBRef( db = "employee")
    private Map<Role, List<Employee>> rolesByGroup;
</code>```

答:
You should do something like this:</p>

```<code>public class EmployeeList {
    @DBRef public List<Employee> employees = new ArrayList<>();
}

private Map<Role, EmployeeList> rolesByGroup;
</code>```

Body:
This is what I am trying to do and it is not working.

@DBRef( db = "employee")
    private Map<Role, List<Employee>> rolesByGroup;

Body:
You should do something like this:

public class EmployeeList {
    @DBRef public List<Employee> employees = new ArrayList<>();
}

private Map<Role, EmployeeList> rolesByGroup;


问:
Apache Nutch fetch and updatedb stages
I've got a question about the way Nutch obtains links to update the crawldb with.

The command in question is bin/nutch updatedb crawl/crawldb $s1

I need to write a custom parser, before doing so I've examined Nutch's source code and as far as I'm concerned I'm responsible for providing the links to update the crawldb, by extracting it from the document and putting in as Outlink[] in the ParseData. At least that's what I understood from this.

Correct me if I'm wrong, because I wouldn't like my crawler to stop after the first iteration, as it wouldn't have links to update the crawldb.

答:
Nutch uses either parse-html or parse-tika to parse your crawled URLs (usually HTML) in this phase the outlinks are extracted and stored, when you execute a new iteration of the crawler Nutch will select some of the available (extracted) links to continue the crawl, you'll only need to write your own parser if you need to extract additional information from the web, let's say that you want all h1 titles in a separate field, for instance.

If you take a look at the crawl script (https://github.com/apache/nutch/blob/master/src/bin/crawl#L246) you'll see that the updatedb command will be executed once per iteration, so if you're using parse-html or parse-tika the outlinks of an HTML document (among others) are automatically extracted for you.

Title: Apache Nutch fetch and updatedb stages


问:
Browser displaying "Directory Listing -- /"
I'm developing the most simple ASP.NET application which is giving me an annoying error.

I'm having a textbox- and a button-control, where I would like the text in the textbox to be saved to a database table when clicking the button. The text will be propagated to the database by means of a WCF service.

Since I'm a rather mediocre programmer, I tend to get errors now and then which results in lots of error messages displayed in the browser. That I can understand. I fix them and build my solution and press F5 to get going. But after fixing the errors, everytime the browser displays a directory listening like the one below instead of my astonishing UI.

Directory Listing -- /

```<code>Monday, December 20, 2010 10:10 PM        <dir> bin
Saturday, December 18, 2010 10:10 PM      1,303 MainForm.aspx
Monday, December 20, 2010 10:28 PM        467 MainForm.aspx.cs
Saturday, December 18, 2010 10:09 PM      2,118 MainForm.aspx.designer.cs
Friday, December 17, 2010 10:25 PM        <dir> obj
Friday, December 17, 2010 10:25 PM        <dir> Properties
Sunday, December 19, 2010 10:09 PM        <dir> Service References
Monday, December 20, 2010 02:01 PM        5,552 SimpleChat.csproj
Monday, December 20, 2010 02:01 PM        1,170 SimpleChat.csproj.user
Sunday, December 19, 2010 10:09 PM        1,810 Web.config
Friday, December 17, 2010 10:25 PM        1,285 Web.Debug.config
Friday, December 17, 2010 10:25 PM        1,346 Web.Release.config
</code>```

Version Information: ASP.NET
  Development Server 10.0.0.0

Why on earth is this happening?

I know how to work around but its tedious: in MainForm.aspx.cs I comment the rows concerning the call to the service, then I rebuild the solution, uncomment the call to the service and rebuild the solution again. Then everything works as expected till I ran into the next bug.

Thanks for reading... ;-)

答:
The easiest fix for you is to right click on the page in your solution that you want to open when you run the project and select "Set as Startup page"

In the example above it would be "MainForm.aspx"

ContentLicense: CC BY-SA 2.5

Body:
I'm developing the most simple ASP.NET application which is giving me an annoying error.

I'm having a textbox- and a button-control, where I would like the text in the textbox to be saved to a database table when clicking the button. The text will be propagated to the database by means of a WCF service.

Since I'm a rather mediocre programmer, I tend to get errors now and then which results in lots of error messages displayed in the browser. That I can understand. I fix them and build my solution and press F5 to get going. But after fixing the errors, everytime the browser displays a directory listening like the one below instead of my astonishing UI.

Directory Listing -- /

Monday, December 20, 2010 10:10 PM        <dir> bin
Saturday, December 18, 2010 10:10 PM      1,303 MainForm.aspx
Monday, December 20, 2010 10:28 PM        467 MainForm.aspx.cs
Saturday, December 18, 2010 10:09 PM      2,118 MainForm.aspx.designer.cs
Friday, December 17, 2010 10:25 PM        <dir> obj
Friday, December 17, 2010 10:25 PM        <dir> Properties
Sunday, December 19, 2010 10:09 PM        <dir> Service References
Monday, December 20, 2010 02:01 PM        5,552 SimpleChat.csproj
Monday, December 20, 2010 02:01 PM        1,170 SimpleChat.csproj.user
Sunday, December 19, 2010 10:09 PM        1,810 Web.config
Friday, December 17, 2010 10:25 PM        1,285 Web.Debug.config
Friday, December 17, 2010 10:25 PM        1,346 Web.Release.config

Version Information: ASP.NET
  Development Server 10.0.0.0

Why on earth is this happening?

I know how to work around but its tedious: in MainForm.aspx.cs I comment the rows concerning the call to the service, then I rebuild the solution, uncomment the call to the service and rebuild the solution again. Then everything works as expected till I ran into the next bug.

Thanks for reading... ;-)


问:
Create a scrollable LinearLayout without a ScrollView
I spent a good part of a day looking into scrolling content in Android. However, in my app I need to apply a custom type of scrolling that contains among other things a listview. A listview has its own scrolling and a scrollview should never be used with a list view together.

But there must be some intrinsic scroll functionality for views. The documentation on View does indicate support but the methods provided do not seem to provide any listeners to detect scrolling.

A scrollview also is built on a FrameLayout which would also be problematic in my app.

You can make a LinearLayout scrollable with:

```<code>android:isScrollContainer="true"
</code>```

but this doesn't seem to do anything.

In fact you can even set the scrollbars for a LinearLayout:

```<code>android:scrollbars="vertical"
</code>```

but that also doesn't seem to do anything.

I don't want to control scrolling but rather have a listener that detects scrolling on the screen regardless whether a listview, framelayout or any other control is visible. I guess what I am looking for is writing my own custom ScrollView control but without the limitations of its FrameLayout and all the unnecessary overhead that I don't need. Any suggestions?

答:
Actually after doing some research, I come up with a solution for this problem:

At first I want to explain the problem in a very simple way.

1.LinearLayout will be scrollable.

2.To do this we can use ScrollView but sometimes we need to use ListView inside LinearLayout.

3.We know that inside ScrollView we cannot use another scrollview like ListView

How to solve that?

ListView is scrollable inherently so we can add header and footer in the ListView. As a conclusion:

1.Create Layout header.xml and footer.xml and list.xml

2.Find the ListView reference from list.xml in the main activity and dynamically add header and footer in the ListView reference.

Body:
I spent a good part of a day looking into scrolling content in Android. However, in my app I need to apply a custom type of scrolling that contains among other things a listview. A listview has its own scrolling and a scrollview should never be used with a list view together.

But there must be some intrinsic scroll functionality for views. The documentation on View does indicate support but the methods provided do not seem to provide any listeners to detect scrolling.

A scrollview also is built on a FrameLayout which would also be problematic in my app.

You can make a LinearLayout scrollable with:

android:isScrollContainer="true"

but this doesn't seem to do anything.

In fact you can even set the scrollbars for a LinearLayout:

android:scrollbars="vertical"

but that also doesn't seem to do anything.

I don't want to control scrolling but rather have a listener that detects scrolling on the screen regardless whether a listview, framelayout or any other control is visible. I guess what I am looking for is writing my own custom ScrollView control but without the limitations of its FrameLayout and all the unnecessary overhead that I don't need. Any suggestions?


问:
Twilio Video using Webrtc
According to Twilio, all I see is information about STUN/TURN and how they charge money for using the TURN/relay server. However, it doesn't make sense to do P2P (wrt performance) for a multi-party conferencing.

So, i'm curious to know if Twilio uses some kind of a media server (for MCU/SFU) in between or does it do P2P connections.

答:
Twilio developer evangelist here.

The Twilio Video API is a room based API, users join rooms to connect to other users. There are two types of rooms though.

Peer to peer rooms use WebRTC's peer to peer nature to connect, and we don't recommend that you try to connect more than 4 users in this way.

Group rooms use a server-routed topology to support a larger number of Participants and features like Recording.

You can set the default room type in the Twilio console on the Video room settings page. You can also create rooms using the REST API and set the type at the time of creation.

Let me know if that helps.

Title: Twilio Video using Webrtc


问:
ionic3 @ionic-native/camera don't show the picture
the camera works  but it's not showing the picture. I've followed some solutions but nothign seems work,
maybe is the ionic3 version?

Before i was able to take a picture,  now button launch on debug chrome 'Illegal Argument Exception'

UPDATE: The problem was when telephone is connect in mode USB, and
  debug mode, the sd card is not enable to save pictures.  So when you
  run:

ionic cordova run android

you must turn off the mode Debug

I can't solve to show  the picture,

here the files:

photo.ts

```<code>import { Component } from '@angular/core';
import { NavController, ToastController } from 'ionic-angular';
import { MainPage } from '../../pages/pages';
import { Vibration } from '@ionic-native/vibration';
import { AuthenticationService } from '../../providers/authentication.service';
import { Camera, CameraOptions } from '@ionic-native/camera';

import { TranslateService } from '@ngx-translate/core';

import {Observable} from 'rxjs/Rx';
@Component({
  selector: 'page-photo',
  templateUrl: 'photo.html'
})
export class PhotoPage {

  // imageData is a base64 encoded string
  public base64Image: string;

  constructor(public navCtrl: NavController,
    public toastCtrl: ToastController,
    private camera: Camera

  ) {

  }

  ngOnInit() {
  }

  takePicture(){
    let options = {
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    };
    this.camera.getPicture(options)
      .then((imageData)=>{
        this.base64Image = "data:image/jpeg;base64," + imageData;

        let cameraImageSelector = document.getElementById('camera-image');
        cameraImageSelector.setAttribute('src', this.base64Image);

      })
      .catch(err=>{
        console.log(err);
      })
  }
}
</code>```

this is another file:
photo.html

```<code><ion-header>

  <ion-navbar>
    <ion-title>Photo</ion-title>
  </ion-navbar>

</ion-header>

<ion-content>

  <img [src]="base64Image" *ngIf="base64Image" />

  <ion-fab bottom right>
    <button ion-fab color="secondary" (click)="takePicture()"><ion-icon name="camera"></ion-icon></button>
  </ion-fab>
</ion-content>
</code>```

this is another file:

app.module.ts

```<code>...import { Camera } from '@ionic-native/camera';
...
@NgModule({
  ...
  providers: [
  ..
    Camera
</code>```

答:
I find the solutions, need use DomSanitizer, because need to update the image from another zone, now the problem sometimes i can take a picture, display the image, but doing again, second or third time the app get close without error or show an error 'error on app' and get close,

I feel ionic cordova is not the same to develop in real platafform? any idea

photo.ts

```<code>   import { Component } from '@angular/core';
    import { NavController, ToastController } from 'ionic-angular';
    import { MainPage } from '../../pages/pages';
    import { AuthenticationService } from '../../providers/authentication.service';
    import { Camera, CameraOptions } from '@ionic-native/camera';
    import { DomSanitizer } from '@angular/platform-browser';

    import { TranslateService } from '@ngx-translate/core';

    import {Observable} from 'rxjs/Rx';
    @Component({
      selector: 'page-photo',
      templateUrl: 'photo.html'
    })
    export class PhotoPage {

      // imageData is a base64 encoded string
      public htmlImageFromCamera: string;

      constructor(public navCtrl: NavController,
        //public toastCtrl: ToastController,
        private camera: Camera,
        private DomSanitizer: DomSanitizer

      ) {

      }

      ngOnInit() {
      }

      takePicture(){
        console.log('take picture');
        let options = {
          quality: 100,
          destinationType: this.camera.DestinationType.DATA_URL,
          encodingType: this.camera.EncodingType.JPEG,
          mediaType: this.camera.MediaType.PICTURE
          //saveToPhotoAlbum: false

        };

        this.camera.getPicture(options)
         .then((imageData)=>{
           console.log('end take picture');
            this.htmlImageFromCamera = "data:image/jpeg;base64," + imageData;
          })
          .catch(err=>{
            console.log(err);
            alert(err);
          })
      }
    }
</code>```

photo.html

```<code><ion-header>

  <ion-navbar>
    <ion-title>Photo</ion-title>
  </ion-navbar>

</ion-header>

<ion-content>

  <ion-card-content>
  Latest Picture:
  <img src="../../assets/img/sarah-avatar.png.jpeg" id ="myimg">
    <img [src]="DomSanitizer.bypassSecurityTrustUrl(htmlImageFromCamera)" *ngIf="htmlImageFromCamera" />
  </ion-card-content>
  <button ion-button round (click)="takePicture()">Take a Picture</button>
</ion-content>
</code>```

Body:
the camera works  but it's not showing the picture. I've followed some solutions but nothign seems work,
maybe is the ionic3 version?

Before i was able to take a picture,  now button launch on debug chrome 'Illegal Argument Exception'

UPDATE: The problem was when telephone is connect in mode USB, and
  debug mode, the sd card is not enable to save pictures.  So when you
  run:

ionic cordova run android

you must turn off the mode Debug

I can't solve to show  the picture,

here the files:

photo.ts

import { Component } from '@angular/core';
import { NavController, ToastController } from 'ionic-angular';
import { MainPage } from '../../pages/pages';
import { Vibration } from '@ionic-native/vibration';
import { AuthenticationService } from '../../providers/authentication.service';
import { Camera, CameraOptions } from '@ionic-native/camera';

import { TranslateService } from '@ngx-translate/core';

import {Observable} from 'rxjs/Rx';
@Component({
  selector: 'page-photo',
  templateUrl: 'photo.html'
})
export class PhotoPage {

  // imageData is a base64 encoded string
  public base64Image: string;

  constructor(public navCtrl: NavController,
    public toastCtrl: ToastController,
    private camera: Camera

  ) {

  }

  ngOnInit() {
  }

  takePicture(){
    let options = {
      quality: 100,
      destinationType: this.camera.DestinationType.DATA_URL,
      encodingType: this.camera.EncodingType.JPEG,
      mediaType: this.camera.MediaType.PICTURE
    };
    this.camera.getPicture(options)
      .then((imageData)=>{
        this.base64Image = "data:image/jpeg;base64," + imageData;

        let cameraImageSelector = document.getElementById('camera-image');
        cameraImageSelector.setAttribute('src', this.base64Image);

      })
      .catch(err=>{
        console.log(err);
      })
  }
}

this is another file:
photo.html

<ion-header>

  <ion-navbar>
    <ion-title>Photo</ion-title>
  </ion-navbar>

</ion-header>

<ion-content>

  <ion-fab bottom right>
    <button ion-fab color="secondary" (click)="takePicture()"><ion-icon name="camera"></ion-icon></button>
  </ion-fab>
</ion-content>

this is another file:

app.module.ts

...import { Camera } from '@ionic-native/camera';
...
@NgModule({
  ...
  providers: [
  ..
    Camera

Body:
I find the solutions, need use DomSanitizer, because need to update the image from another zone, now the problem sometimes i can take a picture, display the image, but doing again, second or third time the app get close without error or show an error 'error on app' and get close,

I feel ionic cordova is not the same to develop in real platafform? any idea

photo.ts

   import { Component } from '@angular/core';
    import { NavController, ToastController } from 'ionic-angular';
    import { MainPage } from '../../pages/pages';
    import { AuthenticationService } from '../../providers/authentication.service';
    import { Camera, CameraOptions } from '@ionic-native/camera';
    import { DomSanitizer } from '@angular/platform-browser';

    import { TranslateService } from '@ngx-translate/core';

    import {Observable} from 'rxjs/Rx';
    @Component({
      selector: 'page-photo',
      templateUrl: 'photo.html'
    })
    export class PhotoPage {

      // imageData is a base64 encoded string
      public htmlImageFromCamera: string;

      constructor(public navCtrl: NavController,
        //public toastCtrl: ToastController,
        private camera: Camera,
        private DomSanitizer: DomSanitizer

      ) {

      }

      ngOnInit() {
      }

      takePicture(){
        console.log('take picture');
        let options = {
          quality: 100,
          destinationType: this.camera.DestinationType.DATA_URL,
          encodingType: this.camera.EncodingType.JPEG,
          mediaType: this.camera.MediaType.PICTURE
          //saveToPhotoAlbum: false

        };

        this.camera.getPicture(options)
         .then((imageData)=>{
           console.log('end take picture');
            this.htmlImageFromCamera = "data:image/jpeg;base64," + imageData;
          })
          .catch(err=>{
            console.log(err);
            alert(err);
          })
      }
    }

photo.html

<ion-header>

  <ion-navbar>
    <ion-title>Photo</ion-title>
  </ion-navbar>

</ion-header>

<ion-content>

  <ion-card-content>
  Latest Picture:
  <img src="../../assets/img/sarah-avatar.png.jpeg" id ="myimg">
    <img [src]="DomSanitizer.bypassSecurityTrustUrl(htmlImageFromCamera)" *ngIf="htmlImageFromCamera" />
  </ion-card-content>
  <button ion-button round (click)="takePicture()">Take a Picture</button>
</ion-content>


问:
AWS CLI: Describe Network ACLs
I am having a bit of an issue with this command. I am trying to list out only the egress ACL rules, and just the rule number. So this is my command:

```<code>aws ec2 describe-network-acls --network-acl-ids acl-c324a5a4 --output text --query 'NetworkAcls[*].Entries[*].{RN:RuleNumber}' --filter Name=entry.rule-action,Values=allow Name=entry.egress,Values=true
</code>```

The return of this is:

```<code>100
110
120
130
140
150
160
170
32767
100
110
120
130
140
150
160
170
32767
</code>```

It is basically listing both egress and ingress rules. The egress and ingress rules have the same rule number. It also lists the *DENY rule (32767), I would also like to avoid that.

Can anyone help me with this command where I want to list out only egress rule numbers?

Thanks

答:
With the help of awk and grep we can get the list of the only Egress rules as shown below.

```<code>aws ec2 describe-network-acls --network-acl-ids acl-63092b1a  --query 'NetworkAcls[*].Entries[*].[Egress,RuleNumber]' --output text | grep -v False | awk {'print $2'} | grep -v '^$\|^\s*\#'
</code>```

To filter results by the value of a specific field, use the JMESPath "?" operator. The following example query outputs only volumes in the us-west-2a availability zone:

```<code>$ aws ec2 describe-volumes --query 'Volumes[?AvailabilityZone==`us-west-2a`]'
</code>```

For More Information please go through this article

Title: AWS CLI: Describe Network ACLs

Body:
I am having a bit of an issue with this command. I am trying to list out only the egress ACL rules, and just the rule number. So this is my command:

aws ec2 describe-network-acls --network-acl-ids acl-c324a5a4 --output text --query 'NetworkAcls[*].Entries[*].{RN:RuleNumber}' --filter Name=entry.rule-action,Values=allow Name=entry.egress,Values=true

The return of this is:

100
110
120
130
140
150
160
170
32767
100
110
120
130
140
150
160
170
32767

It is basically listing both egress and ingress rules. The egress and ingress rules have the same rule number. It also lists the *DENY rule (32767), I would also like to avoid that.

Can anyone help me with this command where I want to list out only egress rule numbers?

Thanks

Body:
With the help of awk and grep we can get the list of the only Egress rules as shown below.

aws ec2 describe-network-acls --network-acl-ids acl-63092b1a  --query 'NetworkAcls[*].Entries[*].[Egress,RuleNumber]' --output text | grep -v False | awk {'print $2'} | grep -v '^$\|^\s*\#'

To filter results by the value of a specific field, use the JMESPath "?" operator. The following example query outputs only volumes in the us-west-2a availability zone:

$ aws ec2 describe-volumes --query 'Volumes[?AvailabilityZone==`us-west-2a`]'

For More Information please go through this article


问:
Can't create folder in Android 7.0
I use this code to create folder.

```<code> File folder2 = new File(Environment.getExternalStorageDirectory() + "/Android");
        if (!folder2.exists()) {
            folder2.mkdir();
        }

 File folder = new File(Environment.getExternalStorageDirectory() + "/Android/MyFolder");
        boolean success = true;
        if (!folder.exists()) {
            success = folder.mkdir();
        }
</code>```

It is working with other devices but not with android v7.0.

I changed and tried with .getAbsolutePath() and .getPath(), but these changing also success on other devices ,7.0 still not yet.

And aslo there was enough permissions on manifest

```<code><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</code>```

Please help me. Thank you for reading.

答:
```<code>public static final int MULTIPLE_PERMISSIONS = 10; // code you want.

 String[] permissions= new String[]{
        Manifest.permission.WRITE_EXTERNAL_STORAGE,
        Manifest.permission.WRITE_EXTERNAL_STORAGE
        };

if (checkPermissions())
         //  permissions  granted.
          createFolder();
}

private  boolean checkPermissions() {
        int result;
        List<String> listPermissionsNeeded = new ArrayList<>();
        for (String p:permissions) {
            result = ContextCompat.checkSelfPermission(getActivity(),p);
            if (result != PackageManager.PERMISSION_GRANTED) {
                listPermissionsNeeded.add(p);
            }
        }
        if (!listPermissionsNeeded.isEmpty()) {
            ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]),MULTIPLE_PERMISSIONS );
            return false;
        }
        return true;
    }

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
        case MULTIPLE_PERMISSIONS:{
            if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
                // permissions granted.
                createFolder();

            } else {
                String permissions = "";
                for (String per : permissionsList) {
                    permissions += "\n" + per;
                }
                // permissions list of don't granted permission
            }
            return;
        }
    }
}

private void createFolder()
{
File folder2 = new File(Environment.getExternalStorageDirectory() + "/Android");
        if (!folder2.exists()) {
            folder2.mkdir();
        }

 File folder = new File(Environment.getExternalStorageDirectory() + "/Android/MyFolder");
        boolean success = true;
        if (!folder.exists()) {
            success = folder.mkdir();
        }
}
</code>```

Title: Can't create folder in Android 7.0

Body:
I use this code to create folder.

 File folder2 = new File(Environment.getExternalStorageDirectory() + "/Android");
        if (!folder2.exists()) {
            folder2.mkdir();
        }

 File folder = new File(Environment.getExternalStorageDirectory() + "/Android/MyFolder");
        boolean success = true;
        if (!folder.exists()) {
            success = folder.mkdir();
        }

It is working with other devices but not with android v7.0.

I changed and tried with .getAbsolutePath() and .getPath(), but these changing also success on other devices ,7.0 still not yet.

And aslo there was enough permissions on manifest

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Please help me. Thank you for reading.


问:
How to monitor my network connection with Java?
Is there any sample code that can report the url that my PC is connecting with Java?

While I use my browser to connect to different sites and watch video online, it should capture the urls. Is it doable in Java?

I don't want detailed traffic, just record the urls.

答: The most commonly used library for doing this kind of stuff is libpcap.  You can find a lot more information about it at tcpdump.org.  Fortunately there is a java wrapper for libpcap, so you can do this kind of stuff in Java.  Check out their examples and tutorial for more info.</p>


问:
Link CSS to HTML for nodejs server
I am trying to link styles.css file to hello.html page to show up in the localhost using nodejs. But the output is only formatted in html and css styling isn't displayed.

Here is my code!

project.js

```<code>var http = require('http');
var fs = require('fs');

http.createServer(function (req,res){
    fs.readFile('hello.html',function(err,data){
    res.writeHead(200,{'Content-Type': 'text/html'});
    res.write(data);
    res.end();
  });

}).listen(8080);
</code>```

hello.html

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="heading">
    <h1>FILE UPLOADING!</h1>
</div>

<form method= "POST" enctype="multipart/form-data" action="fileupload">
<input type="file" name="filetoupload">
<input type="submit" id='bt' value="Submit">
</form>

</body>
</html>
</code>```

style.css

```<code>#heading{
    color:green;
    font-family: sans-serif,serif;
}

#bt{
 background-color: #4CAF50;
color: #ffffff;
border-color: #4CAF50;
}
</code>```

答:
You can take refrence from the below link also you have to serve your css file also using http.
Node.js serve multiple files in one request Code:</p>

```<code>            var http = require('http');
            var fs = require('fs');

            http.createServer(function (req,res){
                if(req.url === '/hello.html') {
                fs.readFile('hello.html',function(err,data){
                res.writeHead(200,{'Content-Type': 'text/html'});
                res.write(data);
                res.end();
              });
                }
                else if(req.url === '/style.css') {
                fs.readFile('style.css',function(err,data){
                res.writeHead(200,{"Content-Type": "text/css"});
                res.write(data);
                res.end();
                });
                }

            }).listen(8080);
</code>```

Title: Link CSS to HTML for nodejs server

Body:
I am trying to link styles.css file to hello.html page to show up in the localhost using nodejs. But the output is only formatted in html and css styling isn't displayed.

Here is my code!

project.js

var http = require('http');
var fs = require('fs');

http.createServer(function (req,res){
    fs.readFile('hello.html',function(err,data){
    res.writeHead(200,{'Content-Type': 'text/html'});
    res.write(data);
    res.end();
  });

}).listen(8080);

hello.html

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="style.css" />

FILE UPLOADING!

<form method= "POST" enctype="multipart/form-data" action="fileupload">
<input type="file" name="filetoupload">
<input type="submit" id='bt' value="Submit">
</form>

style.css

#heading{
    color:green;
    font-family: sans-serif,serif;
}

#bt{
 background-color: #4CAF50;
color: #ffffff;
border-color: #4CAF50;
}

Body:
You can take refrence from the below link also you have to serve your css file also using http.
Node.js serve multiple files in one request Code:

            var http = require('http');
            var fs = require('fs');

            http.createServer(function (req,res){
                if(req.url === '/hello.html') {
                fs.readFile('hello.html',function(err,data){
                res.writeHead(200,{'Content-Type': 'text/html'});
                res.write(data);
                res.end();
              });
                }
                else if(req.url === '/style.css') {
                fs.readFile('style.css',function(err,data){
                res.writeHead(200,{"Content-Type": "text/css"});
                res.write(data);
                res.end();
                });
                }

            }).listen(8080);


答:
if you run your app above Android 6.0 or onwards.you need ask run time permission add this request permission code in you activity file</p>

```<code> String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
            if (ActivityCompat.checkSelfPermission(MainActivity.this, permission)
                    != PackageManager.PERMISSION_GRANTED
                    ) {
                ActivityCompat.requestPermissions(MainActivity.this, new String[]
                        {permission},123);

            }
</code>```

Title: Can't create folder in Android 7.0

Body:
if you run your app above Android 6.0 or onwards.you need ask run time permission add this request permission code in you activity file

 String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
            if (ActivityCompat.checkSelfPermission(MainActivity.this, permission)
                    != PackageManager.PERMISSION_GRANTED
                    ) {
                ActivityCompat.requestPermissions(MainActivity.this, new String[]
                        {permission},123);

            }


问:
Access R Shiny selectizeInput Labels
How can I access the Label of the selected item of a selectizeInput control in shiny from R?

In the below example, if the user clicks on DM Ask, I would like to retrieve the value DM Ask, not DM_ask

```<code>output$group_quote_type_holder <- renderUI({
quote_type_names <- c("Bid Price", "Ask Price", "DM Bid","DM Ask")
quote_type_sql <- c("price_bid","price_ask","DM_bid","DM_ask")
names(quote_type_sql) <- quote_type_names
quote_type_named_list <- quote_type_sql
selectizeInput("group_quote_type",
             label = "Select a type:",
             choices = quote_type_named_list,
             selected = "DM_ask")
})# end renderUI
</code>```

答:
If the value for choices in selectizeInput is a named list, the names are display to the user and values corresponding are returned in the server.

If you want to display "DM Ask" and return "DM Ask", just use your vector quote_type_names, e.g. :

```<code>selectizeInput(
  inputId = "group_quote_type",
  label = "Select a type:",
  choices = c("Bid Price", "Ask Price", "DM Bid", "DM Ask"),
  selected = "DM Ask"
)
</code>```

EDIT

Sorry, I didn't understand. I assume quote_type_named_list don't exit in globaenv and it just define in renderUI, so something like this ?

```<code>library("shiny")

ui <- fluidPage(
  uiOutput(outputId = "group_quote_type_holder"),
  verbatimTextOutput(outputId = "res")
)

server <- function(input, output) {

  quote_type_named_reac <- reactiveValues(x = NULL)

  output$group_quote_type_holder <- renderUI({
    quote_type_names <- c("Bid Price", "Ask Price", "DM Bid","DM Ask")
    quote_type_sql <- c("price_bid","price_ask","DM_bid","DM_ask")
    names(quote_type_sql) <- quote_type_names
    quote_type_named_list <- quote_type_sql

    quote_type_named_reac$x <- quote_type_named_list

    selectizeInput(inputId = "group_quote_type",
                   label = "Select a type:",
                   choices = quote_type_named_list,
                   selected = "DM_ask")
  })

  output$res <- renderPrint({
    names(which(quote_type_named_reac$x == input$group_quote_type))
  })
}

shinyApp(ui = ui, server = server)
</code>```

Title: Access R Shiny selectizeInput Labels

Body:
How can I access the Label of the selected item of a selectizeInput control in shiny from R?

In the below example, if the user clicks on DM Ask, I would like to retrieve the value DM Ask, not DM_ask

output$group_quote_type_holder <- renderUI({
quote_type_names <- c("Bid Price", "Ask Price", "DM Bid","DM Ask")
quote_type_sql <- c("price_bid","price_ask","DM_bid","DM_ask")
names(quote_type_sql) <- quote_type_names
quote_type_named_list <- quote_type_sql
selectizeInput("group_quote_type",
             label = "Select a type:",
             choices = quote_type_named_list,
             selected = "DM_ask")
})# end renderUI

Body:
If the value for choices in selectizeInput is a named list, the names are display to the user and values corresponding are returned in the server.

If you want to display "DM Ask" and return "DM Ask", just use your vector quote_type_names, e.g. :

selectizeInput(
  inputId = "group_quote_type",
  label = "Select a type:",
  choices = c("Bid Price", "Ask Price", "DM Bid", "DM Ask"),
  selected = "DM Ask"
)

EDIT

Sorry, I didn't understand. I assume quote_type_named_list don't exit in globaenv and it just define in renderUI, so something like this ?

library("shiny")

ui <- fluidPage(
  uiOutput(outputId = "group_quote_type_holder"),
  verbatimTextOutput(outputId = "res")
)

server <- function(input, output) {

  quote_type_named_reac <- reactiveValues(x = NULL)

  output$group_quote_type_holder <- renderUI({
    quote_type_names <- c("Bid Price", "Ask Price", "DM Bid","DM Ask")
    quote_type_sql <- c("price_bid","price_ask","DM_bid","DM_ask")
    names(quote_type_sql) <- quote_type_names
    quote_type_named_list <- quote_type_sql

    quote_type_named_reac$x <- quote_type_named_list

    selectizeInput(inputId = "group_quote_type",
                   label = "Select a type:",
                   choices = quote_type_named_list,
                   selected = "DM_ask")
  })

  output$res <- renderPrint({
    names(which(quote_type_named_reac$x == input$group_quote_type))
  })
}

shinyApp(ui = ui, server = server)


问:
Elasticsearch load is not distributed evenly
I am facing strange issue with Elasticsearch. I have 8 nodes with same configurations (16GB RAM and 8 core CPU).

One node "es53node6" has always high load as shown in the screenshot below. Also 5-6 nodes were getting stopped yesterday automatically after every 3-4 hours.

What could be the reason?

ES version : 5.3

答:
there can be a fair share of reasons. Maybe all data is stored on that node (which should not happen by default), maybe you are sending all the requests to this single node.

Also, there is no automatic stopping of Elasticsearch built-in. You can configure Elasticsearch that it stops the JVM process when an out-of-memory exception occurs, but this is not enabled by default as it relies on a more recent JVM.

You can use the hot threads API to check where the CPU time is spent in Elasticsearch.


问:
Bootstrap Carousal need two pagination dots with active class on both
i need your help to solve a issue with bootstrap caraousal pagination. actually, i need two pagination dots on a carousal slider. One will be at bottom of top and one will be in right-side. and both have active class like it show current slide image number. For more check image below you will understand batter.
here is image that help you to understand

here is code i'm using may it can help you also
Fisrt one pagination

```<code> <ol class="carousel-indicators ">
            <li data-target="#myCarousel" data-slide-to="0" class="active">Icon details</li>
            <li data-target="#myCarousel" data-slide-to="1">Icon details</li>
            <li data-target="#myCarousel" data-slide-to="2">Icon details here</li>
            <li data-target="#myCarousel" data-slide-to="3">Icon details here</li>
          </ol>
</code>```

Second Right Side Pagination code

```<code><div class="carouselrightside">
 <ol class="carousel-indicators">
<li data-target="#myCarousel"  data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</code>```

this one is middle image code

```<code><div class="carousel-inner"><div class="recursos_wrap center item active"> <img class="" src="images/recursos1.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos2.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos3.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos4.png" class="img-responsive" alt=""></div></div>
</code>```

that's all please help thanks in advance :)

答:
add and remove active class to second carousel indicators using js

$('.carousel').on('slid.bs.carousel', function() {
  $(".carouselrightside .carousel-indicators li").removeClass("active");
  indicators = $(".carousel-indicators li.active").data("slide-to");
  a = $(".carouselrightside .carousel-indicators").find("[data-slide-to='" + indicators + "']").addClass("active");
})```
<pre class="snippet-code-css lang-css prettyprint-override"><code> .carousel-inner>.item{
   background-color: pink;
   min-width: 300px;
   min-height: 300px;
 }</code>```

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Carousel Example

Icon details

Icon details

Icon details here

Icon details here

```

Body:
i need your help to solve a issue with bootstrap caraousal pagination. actually, i need two pagination dots on a carousal slider. One will be at bottom of top and one will be in right-side. and both have active class like it show current slide image number. For more check image below you will understand batter.
here is image that help you to understand

here is code i'm using may it can help you also
Fisrt one pagination

Icon details

Icon details

Icon details here

Icon details here

Second Right Side Pagination code

this one is middle image code

that's all please help thanks in advance :)

Body:
add and remove active class to second carousel indicators using js

$('.carousel').on('slid.bs.carousel', function() {
  $(".carouselrightside .carousel-indicators li").removeClass("active");
  indicators = $(".carousel-indicators li.active").data("slide-to");
  a = $(".carouselrightside .carousel-indicators").find("[data-slide-to='" + indicators + "']").addClass("active");
})

 .carousel-inner>.item{
   background-color: pink;
   min-width: 300px;
   min-height: 300px;
 }

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="container">
  <h2>Carousel Example</h2>
  <div id="myCarousel" class="carousel slide myCarousel" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators ">
      <li data-target=".myCarousel" data-slide-to="0" class="active">Icon details</li>
      <li data-target=".myCarousel" data-slide-to="1">Icon details</li>
      <li data-target=".myCarousel" data-slide-to="2">Icon details here</li>
      <li data-target=".myCarousel" data-slide-to="3">Icon details here</li>
    </ol>

    <!-- Wrapper for slides -->
<div class="carousel-inner"><div class="recursos_wrap center item active"> <img class="" src="images/recursos1.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos2.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos3.png" class="img-responsive" alt=""></div><div class="recursos_wrap center item "> <img class="" src="images/recursos4.png" class="img-responsive" alt=""></div></div>

    <!-- Left and right controls -->
   <div class="carouselrightside">
 <ol class="carousel-indicators" style="bottom: 0px;">
<li data-target=".myCarousel"  data-slide-to="0" class="active"></li>
<li data-target=".myCarousel" data-slide-to="1"></li>
<li data-target=".myCarousel" data-slide-to="2"></li>
<li data-target=".myCarousel" data-slide-to="3"></li>
</ol></div>
  </div>
</div>


问:
How to make a python project downloaded from github as a frame or package?
such as i download a python project named x-master from github, which comprise a modul named x, and i want use this project just like this:

```<code>import x
from x import ....
</code>```

how should i do on windows??? Appreciate it!

答: If the file you're writing code in is "my_code.py", just save "my_code.py" in the same folder as "x.py".</p>

Body:
such as i download a python project named x-master from github, which comprise a modul named x, and i want use this project just like this:

import x
from x import ....

how should i do on windows??? Appreciate it!


问:
How to deploy Mule Application on Kubernetes?
We are trying to deploy Mule Application on Kubernetes using Minikube. Could you please explain the steps to deploy on Kubernetes in windows environment.</p>

答:
First of all you would need to install Minikube for Windows: https://github.com/kubernetes/minikube/releases

Then, install the API client kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/

Then, according to the needs to your application, you will have to create different API Objects, most likely:

Deployment (also, you may have to create a container): https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

Service: https://kubernetes.io/docs/concepts/services-networking/service/

Persistent Volumes (in case you need persistence): https://kubernetes.io/docs/concepts/storage/persistent-volumes/

This will need some knowledge of how k8s works so I advise you to check the Kubernetes documentation (https://kubernetes.io/docs) and some get started guides.


问:
Why imagettftext does not work?
I have problems with the "imagettftext" function. The following code works if I comment the problematic line (I see a yellow rectangle).

```<code>session_start();
$text = $_SESSION['code'];
header("Content-type: image/gif");
$image = imagecreate(150, 15);
$red_bg = 255; $green_bg = 255; $blue_bg = 155;
$bg_col = imagecolorallocate($image, $red_bg, $green_bg, $blue_bg);
$red_txt = 0; $green_txt = 0; $blue_txt = 0;
$text_col = imagecolorallocate($image, $red_txt, $green_txt, $blue_txt);
$font = "LucidaSansRegular.ttf";
$link_col = imagecolorallocate($image, 0, 0, 255);
//imagettftext($image, 10.0, 0.0, 5, 5, $text_col, $font, "aaaaa");
imagegif($image);
</code>```

But if I uncomment the problematic line (to show some text) I get a problem. Mozilla writes me "The image cannot be displayed, because it contains errors".

May be this is related with the access to my font file (LucidaSansRegular.ttf). All files in my directory have "-rw-r--r--" (including the fond file).

Any suggestions? I need to add that on another server this code worked.

答:
/ means the root directory
./ means the current directory
../ means the parent directory

Hope this explains to you why it worked ;)

Title: Why imagettftext does not work?

Body:
I have problems with the "imagettftext" function. The following code works if I comment the problematic line (I see a yellow rectangle).

session_start();
$text = $_SESSION['code'];
header("Content-type: image/gif");
$image = imagecreate(150, 15);
$red_bg = 255; $green_bg = 255; $blue_bg = 155;
$bg_col = imagecolorallocate($image, $red_bg, $green_bg, $blue_bg);
$red_txt = 0; $green_txt = 0; $blue_txt = 0;
$text_col = imagecolorallocate($image, $red_txt, $green_txt, $blue_txt);
$font = "LucidaSansRegular.ttf";
$link_col = imagecolorallocate($image, 0, 0, 255);
//imagettftext($image, 10.0, 0.0, 5, 5, $text_col, $font, "aaaaa");
imagegif($image);

But if I uncomment the problematic line (to show some text) I get a problem. Mozilla writes me "The image cannot be displayed, because it contains errors".

May be this is related with the access to my font file (LucidaSansRegular.ttf). All files in my directory have "-rw-r--r--" (including the fond file).

Any suggestions? I need to add that on another server this code worked.