Frame Layout issue

31 views
Skip to first unread message

prudhvi p n v

unread,
Mar 25, 2015, 8:04:19 PM3/25/15
to android-d...@googlegroups.com, android-...@googlegroups.com
Hi Guys , 

     I am working on material design navigation drawer using support libraries . On the Main page of the navigation browser , I am trying to display Image, Image caption , Image description .  

   I am using three framelayouts inside of linearlayout with "weightsum"  to embed  each of the Image, Image caption , Image description.Below is the  error output  displayed  by adding gap after image




Here is the XML of the layout image

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include
android:id="@+id/toolbar_actionbar"
layout="@layout/toolbar_default"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_actionbar">

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:clickable="true"
android:layout_height="match_parent" />

<!-- android:layout_marginTop="?android:attr/actionBarSize"-->
<fragment
android:id="@+id/fragment_drawer"
android:name="com.poliveira.apps.materialtests.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation_drawer" />


<LinearLayout
android:layout_below="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/DataDisplay"
android:weightSum="100"
android:orientation="vertical">


<FrameLayout
android:id="@+id/ImageFrame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="50">

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_gravity="fill"
android:scaleType="fitStart"
android:src="@drawable/hower_house" />
</FrameLayout>

<FrameLayout
android:requiresFadingEdge="horizontal"
android:layout_weight="10"
android:id="@+id/ImageName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layoutMode="clipBounds"
android:layout_gravity="left|start">

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:theme="@style/Base.TextAppearance.AppCompat.Caption"
android:text="Image Name"
android:textColor="#000000"
android:textSize="25sp"
android:scaleType="fitStart"
android:id="@+id/ImageNameTextview" />
</FrameLayout>


<FrameLayout
android:id="@+id/TextFrame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="40"
android:layout_gravity="start"
android:paddingTop="10dp">


<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollView">


<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Image Description"
android:id="@+id/ImageDescTextview"
android:textColor="#000000"
android:paddingTop="20dp"
android:scaleType="fitStart"
android:layout_gravity="left|start" />

</ScrollView>

</FrameLayout>


</LinearLayout>


</android.support.v4.widget.DrawerLayout>


</RelativeLayout>

prudhvi p n v

unread,
Mar 31, 2015, 9:45:44 PM3/31/15
to android-d...@googlegroups.com, magou...@gmail.com, android-...@googlegroups.com
Thanks Justin ,
I fixed the issue now
and  other issue I am working right now is to arrange the image , text in proportions like 45% , 55%. 
I want the image to occupy  the 45% of the screen regardless of its size or content or clarity .That's the reason  I included framelayout and weightsum (may not be a best option)







..




On Mon, Mar 30, 2015 at 3:55 PM, Justin Anderson <magou...@gmail.com> wrote:
I"m not entirely sure what you are trying to accomplish here. But I can tell you that you are abusing layouts in a way they were never intended to be used.  For example, you don't need to wrap your TextView and ImageView instances with a FrameLayout.  That is overkill.

First thing I would try is removing all the FrameLayouts and putting the layout_weight attributes directly on the View instances themselves.  Try that and see what happens. It may not fix your problem (I'm betting it won't) but at least there won't be so many moving parts to try to figure out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ibrahim Saputra

unread,
Apr 1, 2015, 10:01:03 AM4/1/15
to android-...@googlegroups.com

I think u can resize the image ... u can see the way here https://www.google.co.id/url?sa=t&source=web&rct=j&ei=IoYbVe7JDM_s8AXoxoCABQ&url=http://stackoverflow.com/questions/14800037/image-resize-rotate-move-by-putting-some-indicator-around-the-image&ved=0CCIQFjAC&usg=AFQjCNE_Y5ZrVXeVUBr6oYWnK-iJyDS1jw&sig2=7aUetn52qn5906piAXcWSg

You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
Reply all
Reply to author
Forward
0 new messages