Skip to content

Commit

Permalink
加入fab按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyc committed Jun 24, 2015
1 parent 36986dd commit c2a44a4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -14,8 +14,6 @@
import android.view.ViewGroup;
import android.widget.TextView;

import org.w3c.dom.Text;

public class MainActivity extends AppCompatActivity {

private RecyclerView mRecyclerView;
Expand Down Expand Up @@ -45,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) {
mRecyclerView.setItemAnimator(new DefaultItemAnimator());

// specify an adapter (see also next example)
myDataset = new String[]{"JAVA", "Object C", "C", "C++", "Swift",
myDataset = new String[]{"JAVA", "Objective-C", "C", "C++", "Swift",
"GO", "JavaScript", "Python", "Ruby", "HTML", "SQL"};
mAdapter = new MyAdapter(myDataset);
mRecyclerView.setAdapter(mAdapter);
Expand Down
Binary file added app/src/main/res/drawable-xxhdpi/ic_favorite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 15 additions & 6 deletions app/src/main/res/layout/activity_main.xml
@@ -1,4 +1,5 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand All @@ -8,16 +9,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimaryDark">
</android.support.v7.widget.Toolbar>
android:background="?attr/colorPrimaryDark"></android.support.v7.widget.Toolbar>


<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:scrollbars="none" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/ic_favorite"
app:fabSize="normal" />
</RelativeLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/layout/item_view.xml
Expand Up @@ -2,7 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="60dp"
android:background="@drawable/item_selector"
android:gravity="center_vertical"
android:orientation="vertical">

<TextView
Expand Down

0 comments on commit c2a44a4

Please sign in to comment.