【发布时间】:2017-12-17 09:57:24
【问题描述】:
我想在 android 中显示我的项目图像和标题这种格式我有一个预览漂亮的这种格式的示例图像请查看我的示例图像
我正在使用此代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.testforme.android.sample.ItemListActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:background="#FFF" >
<ImageView
android:id="@+id/article_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:src="@drawable/item_img"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#7000"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingTop="15dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:shadowColor="#000"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="6"
android:text="Styling Android"
android:textColor="#FFF"
android:textSize="36sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="A guide to applying styles and themes to Android apps"
android:textColor="#CCC"
android:textSize="12sp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
如何将图片和文字设置为示例图片?
【问题讨论】:
-
使用
FrameLayout
标签: android textview imageview styles