豆瓣学习 实现透明的activity 透明的dialog等
1.
<activity android:label="@string/book_detail" android:name=".BookDetailActivity" android:theme="@style/floatwindow" >
2.
<style name="floatwindow" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@drawable/background</item> </style>这样就可以使得activity透明了
书面细节使用了一个table布局 也很好
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" > <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="标题" /> <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="简介" /> <TextView android:id="@+id/tv_summary" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> </TableLayout> <LinearLayout android:id="@+id/ll_book_detail" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/background_dark" android:gravity="center" android:visibility="invisible" > <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </FrameLayout>