赞
踩
昨天写到最后实在是卡的受不了了,今天把这个写完。
最后就是补充几个xml,不知道前面有没有放,在这里补充下。
应该有五个是遗漏的:
我在这里按照顺序依次给出代码,就不标名字了
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/item_image" android:layout_margin="10dp" android:layout_width="280px" android:layout_height="580px" /> <TextView android:textSize="15dp" android:layout_margin="10dp" android:padding="10px" android:textColor="@color/black" android:layout_width="match_parent" android:layout_height="580px" android:id="@+id/item_tv"/> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ImageView android:id="@+id/imageView" android:layout_width="160px" android:layout_height="200px" android:layout_marginLeft="10dp" /> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="200px" android:layout_marginLeft="10dp" android:text="TextView" android:textSize="26dp" android:gravity="center_vertical" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:textColor="@color/black" android:layout_width="match_parent" android:layout_height="60dp" android:gravity="center" android:background="#66FFA000" android:textSize="20dp" android:id="@+id/item_tv"/> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:text="书名: "> </TextView> <TextView android:id="@+id/booknamex" android:layout_width="match_parent" android:layout_height="wrap_content"> </TextView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:text="作者: "> </TextView> <TextView android:id="@+id/authorx" android:layout_width="match_parent" android:layout_height="wrap_content"> </TextView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="1" android:text="简介: "> </TextView> <TextView android:id="@+id/shortx" android:layout_width="match_parent" android:layout_height="wrap_content"> </TextView> </LinearLayout> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="12dp"> <TextView android:id="@+id/item_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLines="2" android:ellipsize="end" android:lineSpacingExtra="3dp" android:paddingTop="10dp" android:textColor="@android:color/black" /> <TextView android:id="@+id/item_time" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#fb7a6a" android:paddingTop="5dp" android:paddingBottom="7dp"/> </LinearLayout>
好了,到此我的项目就介绍完了。大家在参考的时候最好是要明白每一段代码是干啥的,这样即使是碰上了一些小插曲也可以自己轻松的解决。
祝大家学习愉快,嘿嘿。
更新
DBUtils
public class DBUtils { public static final String DATABASE_NAME = "Notepad";//数据库名 public static final String DATABASE_TABLE = "Note"; //表名 public static final int DATABASE_VERION = 1; //数据库版本 //数据库表中的列名 public static final String NOTEPAD_ID = "id"; public static final String NOTEPAD_CONTENT = "content"; public static final String NOTEPAD_TIME = "notetime"; //获取当前日期 public static final String getTime(){ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); Date date = new Date(System.currentTimeMillis()); return simpleDateFormat.format(date); } }
Androidmanifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.ebook"> <application android:allowBackup="true" android:icon="@drawable/appbg" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.Ebook"> <activity android:name=".jiemian5"></activity> <activity android:name=".jiemian4" /> <activity android:name=".jiemian3" /> <activity android:name=".jiemian1" /> <activity android:name=".jiemian2" /> <activity android:name=".ReadBook" /> <activity android:name=".MainLogin" /> <activity android:name=".Register" /> <activity android:name=".RecordActivity" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。