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

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

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

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java RecyclerView片段未出现_Java_Android_Android Fragments_Android Recyclerview_Android Cardview - Fatal编程技术网

Java RecyclerView片段未出现

Java RecyclerView片段未出现,java,android,android-fragments,android-recyclerview,android-cardview,Java,Android,Android Fragments,Android Recyclerview,Android Cardview,我正在尝试创建一个应用程序,以便在recyclerview中显示数据。但是,当我运行它时,主视图是空白的(工具栏和导航抽屉工作正常)。我已经仔细检查了我的代码中的错误,也检查了类似的问题,但到目前为止还没有任何效果。我已经测试了asynctasks,它可以工作,但是信息不会显示出来 主要活动: public class MainActivity extends AppCompatActivity { private DrawerLayout mDrawerLayout; private sta

我正在尝试创建一个应用程序,以便在recyclerview中显示数据。但是,当我运行它时,主视图是空白的(工具栏和导航抽屉工作正常)。我已经仔细检查了我的代码中的错误,也检查了类似的问题,但到目前为止还没有任何效果。我已经测试了asynctasks,它可以工作,但是信息不会显示出来

主要活动:

public class MainActivity extends AppCompatActivity {
private  DrawerLayout mDrawerLayout;
private static ListView mDrawerList;
private static ActionBarDrawerToggle mDrawerToggle;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private static String zipCode = "<zipcode>";
private static String street = "<address>";
public static String[] officeList = null;
public static Elements positionLinks = null;
public static int positionSelected;
public CardFragment currentFragment;
public static String[] namesOfCandidates;
public static String[] partiesOfCandidates;
public static String[] occupationsOfCandidates;
public static String[] candidateLinks;
public static boolean gotCandidates = false;

public static Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    setContentView(R.layout.activity_main);
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    officeList = getResources().getStringArray(R.array.offices_array);
    new AsyncPositions().execute();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    // Set the adapter for the list view
    mDrawerList.setAdapter(new ArrayAdapter<String>(this,
            R.layout.drawer_list_item, officeList));
    // Set the list's click listener
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    mTitle = mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    // Set the drawer toggle as the DrawerListener
    mDrawerLayout.setDrawerListener(mDrawerToggle);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    // Sync the toggle state after onRestoreInstanceState has occurred.
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}

public boolean onPrepareOptionsMenu(Menu menu) {
    // If the nav drawer is open, hide action items related to the content view
    boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
    menu.findItem(R.id.action_favorite).setVisible(!drawerOpen);
    return super.onPrepareOptionsMenu(menu);
}

public boolean onOptionsItemSelected(MenuItem item) {

    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }else if(item.getItemId()==R.id.action_settings){
        Toast.makeText(this, "Settings", Toast.LENGTH_SHORT).show();
        // User chose the "Settings" item, show the app settings UI...
        return true;
    }else if(item.getItemId()==R.id.action_favorite){
        Toast.makeText(this, "Favorited", Toast.LENGTH_SHORT).show();
        // User chose the "Favorite" action, mark the current item
        // as a favorite...
        //remember to change this to something else - or maybe just a starred thing for elected officials
        return true;
    }else {
        // If we got here, the user's action was not recognized.
        // Invoke the superclass to handle it.
        return super.onOptionsItemSelected(item);
    }

}

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.action_bar_buttons, menu);
    return super.onCreateOptionsMenu(menu);
}

private class DrawerItemClickListener implements ListView.OnItemClickListener {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        selectItem(position);
    }
}

    /**
     * Swaps fragments in the main content view
     */
    private void selectItem(int position) {
        positionSelected = position;
        //try {
            new AsyncCandidates().execute();
       /* }
        catch(InterruptedException ie){
            ie.printStackTrace();
        }
        catch(ExecutionException ee){
            ee.printStackTrace();
        }*/


        //change the cards to info about candidate
        // Highlight the selected item, update the title, and close the drawer
        mDrawerList.setItemChecked(position, true);
        setTitle(officeList[position]);
        mDrawerLayout.closeDrawer(mDrawerList);
    }

    @Override
    public void setTitle(CharSequence title) {
        mTitle = title;
    }

public String pollingPlaceInfo(){
    //document.getElementsByClassName("PollingPlace_polling-place-content_ucq")[0].innerText;
    return null;
}

//Gets the information about the specific candidate chosen by the card view
// requests position on drawer and candidate number (index) to pinpoint which candidate
// returns 2d array that contains each issue as well as info about it
public String[][] getIssues(int position, int candidate) {
    return null;
}

//asynctask to pull the positions for the nav drawer
private static class AsyncPositions extends AsyncTask<Void, Void, Void>
{
    ProgressDialog pdLoading = new ProgressDialog(MainActivity.context);
    String[] positions;
    private String zipCode;
    private String street;
    private String urlString = "";
    private Elements positionLinks;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        //this method will be running on UI thread
        pdLoading.setMessage("\tLoading...");
        pdLoading.setCancelable(false);
        pdLoading.setCanceledOnTouchOutside(false);

        pdLoading.show();
        zipCode = MainActivity.zipCode;
        street = MainActivity.street;
    }
    @Override
    protected Void doInBackground(Void... params) {
        Document doc = null;

        urlString = "http://votersedge.org/en/ca/search?zip="+zipCode+"&address="+street;

        try {
            //get initial landing page to find most recent election
            doc = Jsoup.connect(urlString)
                    .userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")
                    .timeout(12000)
                    .followRedirects(true)
                    .get();
            //get the link to the most recent election page
            String newLink = "";
            boolean nullpe = false;
            try{
                doc.body().getElementsByClass("MultipleElections_upcoming-elections_3C2 col-md-12").first().child(1).attr("action");
            }
            catch(NullPointerException npe) {
                newLink = "http://votersedge.org"+doc.body().getElementsByClass("MultipleElections_recent-elections_rsw col-md-12").first().child(1).attr("action");
                nullpe = true;
            }
            if(!nullpe) {
                newLink = "http://votersedge.org" + doc.body().getElementsByClass("MultipleElections_upcoming-elections_3C2 col-md-12").first().child(1).attr("action");
            }

            doc = Jsoup.connect(newLink)
                    .userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")
                    .timeout(12000)
                    .followRedirects(true)
                    .get();
        }
        catch(IOException ioe){
            ioe.printStackTrace();
        }
        Elements positionHeaders = doc.getElementsByClass("ContestsList_jurisdiction-group-label_1Kt");
        positionLinks = doc.getElementsByClass("ContestsList_contest-link_W44");



        //get size of positions list for easy access
        int sizeOfList = positionLinks.size()/2;
        //create array that will be returned
        positions = new String[sizeOfList];
        int l = 0;
        int k=0;
        int j=2;
        for(int i=0; i<sizeOfList; i++){
            try{
                doc.getElementsByClass("ContestsList_accordion-content_1rY card-content").first().child(k).child(j);
            }
            catch(IndexOutOfBoundsException ibe){
                k++;
                j=2;
                l++;
            }

            try{
                doc.getElementsByClass("ContestsList_accordion-content_1rY card-content").first().child(k).child(j).child(0);
            }
            catch(IndexOutOfBoundsException ibe){
                j++;
                l++;
            }

            while(!doc.getElementsByClass("ContestsList_accordion-content_1rY card-content").first().child(k).child(j).child(0).tagName().equals("h4")){
                j++;
                l++;
            }
            positions[i] = positionHeaders.eq(l).text() + " " +doc.getElementsByClass("ContestsList_accordion-content_1rY card-content").first().child(k).child(j).child(0).child(0).child(1).text();
            j++;
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);

        MainActivity.officeList = positions;
        MainActivity.mDrawerList.setAdapter(new ArrayAdapter<>(MainActivity.context,
                R.layout.drawer_list_item, MainActivity.officeList));
        MainActivity.positionLinks = positionLinks;
        pdLoading.dismiss();
    }

}
private class AsyncCandidates extends AsyncTask<Void, Void, Void>
{
    ProgressDialog pdLoading = new ProgressDialog(MainActivity.context);
    private Elements positionElements;
    private int position;
    private String[] namesOfCandidates;
    private String[] partiesOfCandidates;
    private String[] occupationsOfCandidates;
    private String[] candidateLinks;
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        //this method will be running on UI thread
        pdLoading.setMessage("\tLoading...");
        pdLoading.setCancelable(false);
        pdLoading.setCanceledOnTouchOutside(false);
        pdLoading.show();
        positionElements = MainActivity.positionLinks;
        position = MainActivity.positionSelected;

    }
    @Override
    protected Void doInBackground(Void... params) {
        Document doc = null;
        String link = "http://votersedge.org"+ positionElements.eq(position).attr("href");
        try {
            doc = Jsoup.connect(link)
                    .userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")
                    .timeout(12000)
                    .followRedirects(true)
                    .get();
        }
        catch(IOException ioe){
            ioe.printStackTrace();
        }
        //getting links for reference for further information gathering
        //need to create initial array to get all links (each has 1 duplicate in the array)
        // and then create another array to get rid of duplicates
        Elements links = doc.body().getElementsByClass("CandidateCard_candidate-link_2m1");
        String[] cLinks = new String[links.size()];
        for(int i=0; i<links.size(); i++) {
            cLinks[i] = "http://votersedge.org" + links.eq(i).attr("href");
        }
        candidateLinks = new String[links.size()/2];
        for(int i=0; i<links.size(); i+=2){
            candidateLinks[i/2] = cLinks[i];
        }
        //getting names of candidates
        Elements names = doc.body().getElementsByClass("CandidateCard_candidate-name_234 col-md-12 col-xs-12 col-sm-12 flush-cols");
        namesOfCandidates = new String[names.size()];
        for(int i=0; i<names.size(); i++){
            namesOfCandidates[i] = names.eq(i).text();
        }
        //getting political parties of candidates
        Elements attributes = doc.body().getElementsByClass("CandidateCard_candidate-attributes_3qD col-md-12 col-xs-12 col-sm-12 flush-cols");
        partiesOfCandidates = new String[names.size()];
        for(int i=0; i<names.size(); i++){
            partiesOfCandidates[i] = attributes.eq(i).first().child(0).text()+" Candidate";
            if(partiesOfCandidates[i].equals(" Candidate")) partiesOfCandidates[i] = "Candidate";
        }
        //getting occupations of candidates
        occupationsOfCandidates = new String[names.size()];
        for(int i=0; i<names.size(); i++){
            occupationsOfCandidates[i] = attributes.eq(i).first().child(1).text();
        }

        gotCandidates = true;
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);
        MainActivity.namesOfCandidates = namesOfCandidates;
        MainActivity.candidateLinks = candidateLinks;
        MainActivity.partiesOfCandidates = partiesOfCandidates;
        MainActivity.occupationsOfCandidates = occupationsOfCandidates;
        Bundle bundle = new Bundle();
        bundle.putStringArray("names", namesOfCandidates);
        bundle.putStringArray("parties", partiesOfCandidates);
        bundle.putStringArray("links", candidateLinks);
        bundle.putStringArray("occupations", occupationsOfCandidates);


        FragmentManager fm = getSupportFragmentManager();
        MainActivity.this.currentFragment = (CardFragment) fm.findFragmentById(R.id.fragmentContainer);

        if (MainActivity.this.currentFragment == null) {
            MainActivity.this.currentFragment = new CardFragment();
            MainActivity.this.currentFragment.setArguments(bundle);
            fm.beginTransaction()
                    .add(R.id.fragmentContainer, MainActivity.this.currentFragment)
                    .addToBackStack(null)
                    .commit();
        }else{
            MainActivity.this.currentFragment = new CardFragment();
            MainActivity.this.currentFragment.setArguments(bundle);
            fm.beginTransaction()
                    .replace(R.id.fragmentContainer, MainActivity.this.currentFragment)
                    .addToBackStack(null)
                    .commit();
        }
        pdLoading.dismiss();
    }

}

}
public类MainActivity扩展了AppCompatActivity{
私人抽屉布局mDrawerLayout;
私有静态ListView mDrawerList;
私有静态操作bardrawertoggle mDrawerToggle;
私有字符序列mDrawerTitle;
私有字符序列mTitle;
私有静态字符串zipCode=“”;
私人静态字符串街=”;
公共静态字符串[]officeList=null;
公共静态元素positionLinks=null;
选择公共静态文件;
公共卡碎片;
公共静态字符串[]名称和日期;
公共静态字符串[]partiesOfCandidates;
公共静态字符串[]候选人的职业;
公共静态字符串[]候选链接;
公共静态布尔值=false;
公共静态语境;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
上下文=这个;
setContentView(R.layout.activity_main);
工具栏myToolbar=(工具栏)findViewById(R.id.my_工具栏);
officeList=getResources().getStringArray(R.array.offices\u数组);
新建AsyncPositions().execute();
mDrawerLayout=(抽屉布局)findViewById(R.id.抽屉布局);
mDrawerList=(ListView)findViewById(R.id.left\u抽屉);
//设置列表视图的适配器
mDrawerList.setAdapter(新阵列适配器,
R.layout.drawer_list_item,officeList));
//设置列表的单击侦听器
setOnItemClickListener(新的DrawerItemClickListener());
mTitle=mDrawerTitle=getTitle();
mDrawerLayout=(抽屉布局)findViewById(R.id.抽屉布局);
mDrawerToggle=newactionBarDrawerToggle(此,mDrawerLayout,R.string.drawer\u打开,R.string.drawer\u关闭){
/**当抽屉处于完全关闭状态时调用*/
公共无效onDrawerClosed(视图){
super.onDrawerClosed(视图);
InvalidateOptions SMenu();//创建对OnPrepareOptions SMenu()的调用
}
/**当抽屉处于完全打开状态时调用*/
打开图纸上的公共空白(视图抽屉视图){
super.onDrawerOpened(抽屉视图);
InvalidateOptions SMenu();//创建对OnPrepareOptions SMenu()的调用
}
};
//将抽屉开关设置为抽屉定位器
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
@凌驾
后期创建时受保护的空(捆绑包savedInstanceState){
super.onPostCreate(savedInstanceState);
//在onRestoreInstanceState发生后同步切换状态。
mDrawerToggle.syncState();
}
@凌驾
公共无效OnConfiguration已更改(配置newConfig){
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
公共布尔值OnPrepareOptions菜单(菜单){
//如果导航抽屉打开,则隐藏与内容视图相关的操作项
boolean-DrawerLayout=mDrawerLayout.isDrawerOpen(mDrawerList);
menu.findItem(R.id.action_favorite).setVisible(!drawerropen);
返回super.onPrepareOptions菜单(菜单);
}
公共布尔值onOptionsItemSelected(菜单项项){
如果(MDRAWERTOGLE.onOptionsItemSelected(项目)){
返回true;
}else if(item.getItemId()==R.id.action\u设置){
Toast.makeText(这是“设置”,Toast.LENGTH_SHORT).show();
//用户选择“设置”项,显示应用程序设置界面。。。
返回true;
}else if(item.getItemId()==R.id.action\u收藏夹){
Toast.makeText(这个“Favorited”,Toast.LENGTH_SHORT).show();
//用户选择“收藏”操作,标记当前项目
//作为我的最爱。。。
//记住,把这件事改成其他的事情——或者对当选官员来说,可能只是一件有明星效应的事情
返回true;
}否则{
//如果我们到了这里,用户的行为就不会被识别。
//调用超类来处理它。
返回super.onOptionsItemSelected(项目);
}
}
公共布尔onCreateOptions菜单(菜单){
//为菜单项充气,以便在操作栏中使用
MenuInflater充气机=getMenuInflater();
充气机。充气(右菜单。操作栏按钮,菜单);
返回super.onCreateOptions菜单(菜单);
}
私有类DrawerItemClickListener实现ListView.OnItemClickListener{
@凌驾
public void onItemClick(AdapterView父对象、视图、整型位置、长id){
选择项目(位置);
}
}
/**
*在主内容视图中交换片段
*/
私有void selectItem(内部位置){
所选位置=位置;
//试一试{
新的异步候选项().execute();
/* }
捕获(中断异常ie){
即printStackTrace();
}
捕获(被执行者){
ee.printStackTrace();
}*/
//将卡片更改为关于候选人的信息
//突出显示所选项目,更新标题,然后关闭抽屉
mDrawerList.setItemChecked(位置,true);
setTitle(公职人员[职位]);
mDrawerLayout.closeDrawer(mDrawerList);
}
@凌驾
公共无效设置标题(字符序列标题){
mTitle=标题;
}
公共字符串pollingPlaceInfo(){
//document.getElementsByClassName(“PollingPlace\u polling-place-content\u ucq”)[0]。innerText;
返回null;
}
//获取有关卡视图选择的特定候选人的信息
//请求抽屉上的位置和候选人编号(索引),以确定哪位候选人
//返回包含每个问题及其相关信息的二维数组
公共字符串[][]获取问题(整数位置,整数候选){
返回null;
}
//asynctask为t提取位置
public class CardFragment extends Fragment {

RecyclerView MyRecyclerView;
String[] namesOfCandidates;
String[] partiesOfCandidates;
String[] occupationsOfCandidates;
String[] candidateLinks;



@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d("test", "fragment has been created");

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    this.getArguments();
    namesOfCandidates = this.getArguments().getStringArray("names");
    partiesOfCandidates = this.getArguments().getStringArray("parties");
    candidateLinks = this.getArguments().getStringArray("links");
    occupationsOfCandidates = this.getArguments().getStringArray("occupations");
    View view = inflater.inflate(R.layout.fragment_card, container, false);
    MyRecyclerView = (RecyclerView) view.findViewById(R.id.cardView);
    MyRecyclerView.setHasFixedSize(true);
    LinearLayoutManager MyLayoutManager = new LinearLayoutManager(getActivity());
    MyLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    if (namesOfCandidates.length > 0 & MyRecyclerView != null) {
        MyRecyclerView.setAdapter(new MyAdapter(namesOfCandidates));
    }
    MyRecyclerView.setLayoutManager(MyLayoutManager);

    return view;
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

}

public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> {
    private String[] list;

    public MyAdapter(String[] Data) {
        list = Data;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent,int viewType) {
        // create a new view
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.recycle_items, parent, false);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, int position) {

        holder.titleTextView.setText(list[position]);
        holder.mainTextView.setText(CardFragment.this.partiesOfCandidates[position]+"Candidate\n"+CardFragment.this.occupationsOfCandidates[position]);
        holder.arrowImageView.setTag(R.drawable.ic_arrow_forward_black_24dp);

    }

    @Override
    public int getItemCount() {
        return list.length;
    }
}

public class MyViewHolder extends RecyclerView.ViewHolder {

    TextView titleTextView;
    ImageView arrowImageView;
    TextView mainTextView;

    public MyViewHolder(View v) {
        super(v);
        titleTextView = (TextView) v.findViewById(R.id.titleTextView);
        mainTextView = (TextView) v.findViewById(R.id.mainTextView);
        arrowImageView = (ImageView) v.findViewById(R.id.arrowImageView);
        arrowImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                int id = (int)arrowImageView.getTag();
                if( id == R.drawable.ic_arrow_forward_black_24dp) {

                    //MOVE TO NEXT SCREEN
                }
            }
        });





    }
}
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragmentContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
</FrameLayout>

<!-- Action bar -->
<android.support.v7.widget.Toolbar
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
    android:theme="@style/ThemeOverlay.AppCompat.Light"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_left_margin"
android:paddingRight="@dimen/activity_right_margin"
android:paddingTop="@dimen/activity_vertical_margin">

<android.support.v7.widget.RecyclerView
    android:id="@+id/cardView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
</RelativeLayout>
<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_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardCornerRadius="4dp">


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="@dimen/card_height"
    android:orientation="vertical"
    android:weightSum="4">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="left|bottom"
        android:background="@android:drawable/screen_background_dark_transparent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/titleTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="16dp"
            android:textSize="@dimen/text_size"
            android:textColor="#FFFFFF"
            android:textStyle="bold" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="3.2"
        android:orientation="vertical">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal">

            <TextView
                android:id="@+id/mainTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="16dp"
                android:textSize="@dimen/text_size2"
                android:layout_gravity="center"
                />


        </FrameLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.8"
        android:gravity="center|right"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/arrowImageView"
            android:layout_width="@dimen/icon_width"
            android:layout_height="@dimen/icon_height"
            android:padding="@dimen/icon_padding"
            android:src="@drawable/ic_arrow_forward_black_24dp" />
    </LinearLayout>

</LinearLayout>
</android.support.v7.widget.CardView>