[英]Android Studio RSS Reader.
I'm currently working on attempting to make an RSS Reader using a ListView in Android studio. 我目前正在尝试使用Android Studio中的ListView制作RSS阅读器。 I've already managed to make the ListView, but i have no idea where to go next.
我已经设法制作了ListView,但是我不知道下一步要去哪里。 I cant seem to find any good tutorials online on how i should tackle this, and Anything i do find is out of date by 3 years.
我似乎无法在网上找到任何有关如何解决此问题的优秀教程,而我发现的任何内容都已过时3年。 Any tips?
有小费吗?
activity_main.xml activity_main.xml中
<?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_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.micha.rssreader.MainActivity">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="@+id/listviewAD" />
MainActivity.java MainActivity.java
package com.example.micha.rssreader;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
public ListView AdFeed; // maakt listview aan
public String[] items;
public ArrayAdapter<String> adapt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdFeed = (ListView)findViewById(R.id.listviewAD);
items = new String[]{"blue", "red", "black", "orange", "purpol"};
adapt = new ArrayAdapter<String>(this, R.layout.items, items);
AdFeed.setAdapter(adapt);//zet de data acther de listview
AdFeed.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
}
Try this example 试试这个例子
http://www.androidauthority.com/simple-rss-reader-full-tutorial-733245/ http://www.androidauthority.com/simple-rss-reader-full-tutorial-733245/
it is up to date since it uses buildToolsVersion 25.0.1. 由于它使用buildToolsVersion 25.0.1,所以它是最新的。 Only difference is that it uses RecyclerView instead of ListView, which is recommended since it is lighter than ListView
唯一的不同是它使用RecyclerView而不是ListView,因此建议使用它,因为它比ListView轻
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.