TextView的滚动ImageView的背后 [英] Textview Scrolling Behind the Imageview

查看:101
本文介绍了TextView的滚动ImageView的背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序要滚动在ImageView的TextView的,但在我的XML设计的ImageView背后的TextView的滚动,如何滚动的ImageView TextView的,请给我的解决方案。

这是我的XML code。

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =match_parent'输入code here`
机器人:layout_height =match_parent
机器人:方向=垂直>    <的FrameLayout
        机器人:ID =@ + ID /帧
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT>        < RelativeLayout的
            机器人:ID =@ + ID / IMG
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent>
         < ImageView的
                   机器人:ID =@ + ID / article_image
                   机器人:layout_width =match_parent
                   机器人:layout_height =250dp
                   机器人:layout_gravity =顶
                   机器人:scaleType =fitXY
                   机器人:SRC =@绘制/花园/>             <的TextView
                   机器人:ID =@ + ID / image_desc
                   机器人:layout_width =match_parent
                   机器人:layout_height =WRAP_CONTENT
                   机器人:背景=#77000000
                   机器人:比重=中心|底
                   机器人:填充=8DP/>      < / RelativeLayout的>
   < /&的FrameLayout GT;    < RelativeLayout的
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:layout_below =@ + ID /帧>             <滚动型
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:背景=#77000000>
            < RelativeLayout的
                    机器人:layout_width =match_parent
                    机器人:layout_height =WRAP_CONTENT
                    机器人:方向=垂直
                    机器人:填充=16DP>            <的TextView
                    机器人:ID =@ + ID / article_body
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:背景=#FFFFFF
                    机器人:文字=一个很好的做法,带来最佳的性能
                    对于Android应用程序是要确保你的主线程呢
                    工作的最小量。任何长时间运行的任务或重
                    操作通常在不同的线程执行。
                    典型的长时间运行的任务可能是网络运营,
                    读取文件形成存储器,动画等。在这篇文章中,
                    我们将建立在Android中一个简单的异步的ListView。
                    ListView的在每个行缩略图的缩略图
                    (如显示如下图所示)将被异步加载
                    表单服务器。我们将填充缩略图一个ListView
                    从使用AsyncTask.A好习惯网上下载带来最佳性能
                    对于Android应用程序是要确保你的主线程呢
                    工作的最小量。任何长时间运行的任务或重
                    操作通常在不同的线程执行。
                    典型的长时间运行的任务可能是网络运营,
                    读取文件形成存储器,动画等。在这篇文章中,
                    我们将建立在Android中一个简单的异步的ListView。
                    ListView的在每个行缩略图的缩略图
                    (如显示如下图所示)将被异步加载
                    表单服务器。我们将填充缩略图一个ListView
                    从使用的AsyncTask/&GT网上下载;            < / RelativeLayout的>
        < /滚动型>
        < / RelativeLayout的>
   < / RelativeLayout的>



解决方案

 <的FrameLayout
    机器人:ID =@ + ID /帧
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>
     < ImageView的
               机器人:ID =@ + ID / article_image
               机器人:layout_width =match_parent
               机器人:layout_height =250dp
               机器人:layout_gravity =顶
               机器人:scaleType =fitXY
               机器人:SRC =@绘制/花园/>      <滚动型
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent>    <的LinearLayout
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:方向=垂直>        <的TextView
            机器人:ID =@ + ID / textView1
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginTop =100dp
            机器人:文字=@字符串/参考hello world/>
    < / LinearLayout中>
< /滚动型>
  < /&的FrameLayout GT;

为此,我希望这是工作..我有同样的问题,由该期运用解决。

In my application I want to scroll the TextView over the ImageView, but in my XML Design the TextView scroll behind the ImageView, how to scroll the TextView on ImageView, please give me the solution.

This is my XML code.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"`enter code here`
android:layout_height="match_parent"
android:orientation="vertical" >

    <FrameLayout 
        android:id="@+id/frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:id="@+id/img" 
            android:layout_width="match_parent"
            android:layout_height="match_parent">


         <ImageView
                   android:id="@+id/article_image"
                   android:layout_width="match_parent"
                   android:layout_height="250dp"
                   android:layout_gravity="top"
                   android:scaleType="fitXY"
                   android:src="@drawable/garden"/>

             <TextView
                   android:id="@+id/image_desc"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:background="#77000000"
                   android:gravity="center|bottom"
                   android:padding="8dp"/>

      </RelativeLayout>  
   </FrameLayout>  

    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/frame">

             <ScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#77000000">


            <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp" >

            <TextView
                    android:id="@+id/article_body"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#ffffff"
                    android:text="A good practice to bring the best performance 
                    for android application is to make sure your main thread does 
                    the minimum amount of work. Any long running tasks or heavy 
                    operations are usually performed in a different thread. 
                    Typical long running tasks could be network operations, 
                    reading files form memory, animations, etc. In this article, 
                    we will create a simple asynchronous ListView in Android. 
                    ListView with thumbnails thumbnails on each row 
                    (as shows in the image below) will be loaded asynchronously 
                    form server. We will populate a ListView with thumbnail images 
                    downloaded from the internet using a AsyncTask.A good practice to bring the best performance 
                    for android application is to make sure your main thread does 
                    the minimum amount of work. Any long running tasks or heavy 
                    operations are usually performed in a different thread. 
                    Typical long running tasks could be network operations, 
                    reading files form memory, animations, etc. In this article, 
                    we will create a simple asynchronous ListView in Android. 
                    ListView with thumbnails thumbnails on each row 
                    (as shows in the image below) will be loaded asynchronously 
                    form server. We will populate a ListView with thumbnail images 
                    downloaded from the internet using a AsyncTask." />

            </RelativeLayout>
        </ScrollView>
        </RelativeLayout>
   </RelativeLayout>

解决方案

<FrameLayout 
    android:id="@+id/frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">




     <ImageView
               android:id="@+id/article_image"
               android:layout_width="match_parent"
               android:layout_height="250dp"
               android:layout_gravity="top"
               android:scaleType="fitXY"
               android:src="@drawable/garden"/>

      <ScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >

    <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="100dp"
            android:text="@string/hello_world" />
    </LinearLayout>
</ScrollView>
  </FrameLayout >  

Do this I hope this is working.. I have same problem and solve by useing this.

这篇关于TextView的滚动ImageView的背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆