这是一个简单的线性布局,有1个ImageView、6个TextView和一个ScrollView,但TextView显示在屏幕的末尾,而不是ImageView下面。我尝试过用样式编辑我的dp值。xml但仍不工作请查看!!
我也尝试过编辑ImageView标签,但仍然不起作用,不知道为什么文本视图会出现在屏幕的末尾,如果我删除ScrollView,文本将不可见。
布局代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#000000"
tools:context="com.example.stan.sportbusinesscard.MainActivity">
<ImageView
android:scaleType="fitStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/photo_description"
android:src="@drawable/photo"
android:id="@+id/image"/>
<TextView
style="@style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title" />
<TextView
style="@style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text1"/>
<TextView
style="@style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/where" />
<TextView
style="@style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/address"
android:autoLink="map"/>
<TextView
style="@style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/when" />
<TextView
style="@style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dateOf" />
</LinearLayout>
</ScrollView>
样式。xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="LightText" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:paddingLeft">18dp</item>
<item name="android:paddingRight">18dp</item>
<item name="android:textColor">#aaaaaa</item>
</style>
<style name="TitleText" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:paddingLeft">18dp</item>
<item name="android:paddingRight">18dp</item>
<item name="android:paddingTop">20dp</item>
<item name="android:textSize">18sp</item>
<item name="android:textColor">#FFD700</item>
</style>
</resources>