android设计新闻详情页面的布局代码 要求:漂亮
时间: 2023-12-09 19:05:36 浏览: 23
好的,我可以为您提供一个漂亮的Android新闻详情页面布局代码,如下所示:
```xml
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="这是新闻标题"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dateTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="发布日期:2022年2月2日"
android:textColor="@color/gray"
android:textSize="16sp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:src="@drawable/news_image" />
<TextView
android:id="@+id/contentTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="新闻正文内容"
android:textSize="18sp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="24dp"
android:background="@color/blue"
android:text="查看更多"
android:textColor="@color/white" />
</LinearLayout>
</ScrollView>
```
这个布局代码中包含了一个 ScrollView 和一个垂直方向的 LinearLayout,可以让用户在滚动页面时能够自由查看新闻内容。布局中包含一个新闻标题、发布日期、新闻配图、新闻正文内容以及一个查看更多的按钮,可以为用户提供完整的新闻阅读体验。同时,我也为新闻标题、发布日期和查看更多的按钮设置了漂亮的样式,以提升用户体验。