我有一个cardView
card_contents.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.v7.widget.CardView android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:id="@+id/card_view">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffa3a4a6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/card_text"
android:layout_gravity="center"
android:gravity="center"
android:text="B.E"
android:layout_centerInParent="true"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/button1"
android:layout_toLeftOf="@+id/view"
android:layout_alignParentLeft="true"
android:text="2010"
android:textColor="#000000"
android:background="@android:color/transparent"
/>
<View
android:layout_width="2dp"
android:layout_height="@dimen/abc_action_button_min_height_material"
android:layout_centerHorizontal="true"
android:id="@+id/view"
android:background="@android:color/black"
android:layout_alignParentBottom="true"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/view"
android:background="@android:color/transparent"
android:textColor="@android:color/black"
android:text="2014"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
MainActivity.class
public class MainActivity extends ActionBarActivity {
RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<String> list=new …Run Code Online (Sandbox Code Playgroud) android ontouchlistener onitemclicklistener android-cardview android-recyclerview
android ×1