我想创建每个列表项的recyclerview具有自定义的行垂直.
但我创建列表项然后行不显示.
custom_line
line_story_view.xml
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="wrap_content"
    android:layout_height="match_parent">
    <View
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:background="#EEEEEE"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:id="@+id/line_test" />
    <View android:layout_width="10dp"
        android:layout_height="10dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="45dp"
        android:background="@drawable/bg_test_line" />
</RelativeLayout>
项目清单
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
    <RelativeLayout
        android:layout_width="95dp"
        android:layout_height="wrap_content"
        android:id="@+id/relativeLayout67">
        <com.makeramen.roundedimageview.RoundedImageView
            android:id="@+id/rv_profile"
            android:layout_width="48dp"
            android:layout_height="48dp"
            app:riv_border_color="#cacaca"
            app:riv_corner_radius="2dip"
            android:src="@drawable/plachholder"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="25dp" />
        <TextView
            android:id="@+id/tvwTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Loading..."
            android:textAppearance="@style/AppTheme.TextAppearance"
            android:textColor="#a3a3a3"
            android:textSize="12dp"
            android:layout_below="@+id/rv_profile"
            android:layout_alignLeft="@+id/rv_profile"
            android:layout_alignStart="@+id/rv_profile"
            android:layout_marginTop="10dp" />
        <com.example.bestiiz.component.LineStoryView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:id="@+id/line" />
    </RelativeLayout>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" …android recycler-adapter android-recyclerview recyclerview-layout
我想用Android芯片实现Tag Cloud.
但我认为最好的方法是使用RecycleView和自定义LayoutManager.我搜索一个LayoutManager,它将其子项布局为FlowLayout,但什么都没找到.
是否有人发现了这种行为或关于自定义布局管理器的简单教程?我发现没有简单或简单但不完整的文章.
在将数据集设置到适配器之前,我是从Room数据库中获取数据集,然后将数据设置到适配器并将适配器设置到recyclerview。目前列表中有 2 个项目。从我的日志中,我看到列表中的第一个项目调用了所有方法,但第二个没有调用,并且屏幕上没有显示任何项目或视图。我不确定发生了什么,有人可以帮助我发现问题吗?在此先感谢您的帮助。
目标_内容.xml
 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:clickable="true"
    android:orientation="vertical">
    <android.support.v7.widget.RecyclerView
        android:id="@+id/goals_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutManager="LinearLayoutManager"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="1px"
        android:visibility="gone"
        />
    <!--view to show if the dataset is empty-->
    <TextView
        android:id="@+id/emptyElement"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:visibility="visible"
        android:text="No Goals Added"
        android:textColor="#525252"
        android:textSize="19sp"/>
</LinearLayout>
目标活动.java
GoalsRecyclerViewAdapter adapter;
RecyclerView goalsListView;
....
goalsListView = (RecyclerView) findViewById(R.id.goals_list);
....
private void createGoalsList() {
        new AsyncTask<Void, Void, List<Goal>>(){
            @Override
            protected List<Goal> doInBackground(Void... params) {
                List<Goal> returnedGoals = goalDao.getAllGoals();
                return returnedGoals;
            }
            @Override
            protected void …我有RecyclerView,每个行布局都有一个ImageView和一个TextView.在RecyclerViewAdapter的ViewHolder中,我有点击监听器
 v.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
                     Images i=list.get(getAdapterPosition());
                     i.setFlag(!i.getFlag());
                     list.set(getAdapterPosition(),(i));
                     notifyDataSetChanged();
                 }
             });
在那个点击监听器中,我正在更改布尔标志,以便它可以显示是否选择了一个项目.根据它的值, 我想通过检查遍历整个ArrayList
for(int i=0; i<images.size(); i++){
                if(images.get(i).getFlag()){
                    // there I want to get view from LayoutManager for that item
                    //but how to get view for that item and get Bitmap form imageview for that item
                    //end of geting view 
                }
            }
我的 RecyclerView 项目包含三个 EditText。
我想将我的焦点从第一个 EditText 移到第二个和第三个。
然后在我想将重点放在下一个 RecyclerView 项目的第一个 EditeText 上之后。
当我按下软键盘的下一步按钮时,所有过程都会发生。
我有 3 种不同的布局cardsListLayout,titleLayout,cardMagazineLayout将来可能会有更多,用作方法的视图onCreateViewHolder。
我想在onCreateViewHolder方法中的视图之间切换,所以当用户从 AlertDialog 列表中选择时
这个 onOptionsItemSelected 在 MainActivity 那里有菜单项“更改布局”,以便当用户按下它时出现 AlertDialog 列表
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.change_layout) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.choose_layout));
            String[] layouts = {"Title Layout", "Cards List", "Card Magazine Layout"};
            builder.setItems(layouts, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int index) {
                    switch (index) {
                        case 0: // Title layout
                            Toast.makeText(MainActivity.this,
                                    "Title layout", Toast.LENGTH_LONG).show();
                            break;
                        case 1: // Cards List …android android-layout android-viewholder android-recyclerview recyclerview-layout
我试图在我的 RecyclerView 上实现涟漪效应。这是我的布局:
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card"
        android:layout_marginTop="7dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="5dp"
        android:clickable="true"
        card_view:cardElevation="5dp"
        android:focusable="true"
        android:foreground="?android:attr/selectableItemBackground">
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="16dp">
                <TextView
                    //some properties />
                <TextView
                    //some properties />
                <TextView
                    //some properties />
            </LinearLayout>
    </android.support.v7.widget.CardView>
为了实现 onclick 监听器,我基本上遵循了本教程:http : //sapandiwakar.in/recycler-view-item-click-handler/
问题是涟漪效应,由于线条而产生:
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
不适用于轻型(即快速)印刷机。当我快速点击屏幕时,点击监听器被触发。这意味着已检测到触摸事件,但没有显示涟漪效应。如果我想看到涟漪效果,我必须在释放之前在屏幕上保持一段时间的压力。
有没有办法纠正这种行为并即使在快速按下时也能显示涟漪效应?
我希望有人能帮助我解决我的问题。我有一个有 3 个选项卡的 Android 应用程序,我使用片段,第一个选项卡是 recyclerView 列表,第二个选项卡是地图。问题出在选项卡 1 中,我需要通过齐射获取数据到选项卡 1 上的 recyclerView,如果运行正常,但我在第一个应用程序启动时看不到数据,但是当我再次更改选项卡并返回选项卡 1 时,它将刷新数据并在recyclerView上显示数据。
适配器.java
public class CustomListAdapterWarkop extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private Context context;
    private List<Warkop> mWarkop;
    private LayoutInflater inflater;
    public CustomListAdapterWarkop(Context context, List<Warkop> mWarkop) {
        this.context=context;
        inflater= LayoutInflater.from(context);
        this.mWarkop = mWarkop;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.list_warkop_row, parent, false);
        ItemViewHolder holder = new ItemViewHolder(view);
        return holder;
    }
    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ItemViewHolder viewHolder = (ItemViewHolder) holder;
        Warkop current …该文档对getItemCount()进行了以下说明:
返回绑定到父RecyclerView的适配器中的项目数。请注意,此数字不一定等于State#getItemCount()。
那么,它返回适配器中的所有项目还是屏幕上可见的项目?我不明白 有人可以解释这种方法吗?
我在片段中有一个 RecyclerView 。我需要收到滚动更改的通知,因此我添加了一个ScrollChange事件回调(对应于SetOnScrollChangeListener经典的 Android API):
private void RecyclerViewScrollChange(object sender, View.ScrollChangeEventArgs e)
{
    int deltaY = e.ScrollY - e.OldScrollY;
}
问题在于 deltaY 始终为零,因为 ScrollY 和 OldScrollY 始终为零。我在回收器视图的布局管理器中使用垂直线性布局,因此应该更新垂直尺寸。什么会导致这个问题?
android xamarin.android android-recyclerview recyclerview-layout