Linearlayout changes size (ratio) when i set Image to ImageView

Wednesday, November 4, 2015

I have a dialog with the XML code below, what i wanted to do is just like what is showed in first screenshot (and it is exactly what is showed on the screen when i keep the imageview empty) :



Normal app running without image inside imageView



but when i put the picture inside the imageView using the code :



ImageView img1 = (ImageView) myView.findViewById(R.id.imgView1);
img1.setImageResource(R.drawable.attention);
img1.setScaleType(ImageView.ScaleType.CENTER_INSIDE);


the screen becomes :



When app runs and image inside the imageView



I dont want the linearlayout that contains the imageViews to change the ration, i put the weight ("3") to always keep same ratio, but although it changes.



above my XML source :



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

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="10dp"
android:orientation="vertical"
android:weightSum ="10">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="1"
android:background="@drawable/dialog_bg">

<TextView
android:id="@+id/txt_field1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="1"
android:background="@drawable/dialog_bg">

<TextView
android:id="@+id/txt_field2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:textColor="@color/black"/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="left"
android:orientation="vertical"
android:layout_weight="2"
android:background="@drawable/dialog_bg">

<TextView
android:id="@+id/txt_field3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp"
android:textColor="@color/black" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="left"
android:orientation="horizontal"
android:layout_weight="3"
android:background="@drawable/dialog_bg">

<ImageView
android:id="@+id/imgView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp"
android:layout_weight="1"
android:scaleType = "fitXY" />

<ImageView
android:id="@+id/imgView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp"
android:layout_weight="1"
android:scaleType = "fitXY"/>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="left"
android:orientation="horizontal"
android:layout_weight="3"
android:background="@drawable/dialog_bg">

<ImageView
android:id="@id/imgView3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp"
android:layout_weight="1"
android:scaleType = "fitXY"/>

<ImageView
android:id="@id/imgView4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingEnd="10dp"
android:layout_weight="1"
android:scaleType = "fitXY"/>

</LinearLayout>

</LinearLayout>
</RelativeLayout>


Please any suggestion how to bypass this issue. Thank you.

Keep the backslashs in propertyregex

I'm trying to replace a directory path string in a XML file using ANT with the value stored in variable ${param_value}.



In my example ${param_value} contains c:\mypath\mydir



In order to replace as wished, I use propertyregex.



The issue is that the regex replace value is c:mypathmydir
I don't understand why "replace" removes all backslashes.



When I echo to check the value of my variable before regex, it looks like:



<echo message="param_value out=${param_value}"/>


This echo returns c:\mypath\mydir



${param_token} is xml token (output)



<propertyregex      property="param_temp"
input="${result}"
regexp="(&lt;${param_token})&gt;(.*|\\)*&lt;(/${param_token}&gt;)"
replace="\1&gt;${param_value}&lt;\3"
casesensitive="false"
defaultvalue="NotFound"/>


Thank you for your help.

Can ant build.xml build target from a variable anount of input files

First excuse my bad English.



Here is the concept:
I have to implement multiple xslt transformations.
How many transformations shall be executed, depends on how many xml files will be in a separate directory/folder. So the problem is: How to tetll the build.xml (the ant build file) to do a loop that iterates a task for each file in a directory.
This is meta code is an attempt to describe the idea:



 foreach(test-cases/*.xml)
{
<xslt
in="." out="report_(n+1).xml" style="ConstantStylesheet.xslt">
</xslt>
}


The stylesheet will not change per transformations, only the input and the output files.



in="." refers to the coherent xml file as an input for the xslt processor.



report_${.}.xml is to tell the processor that the output file name will be suffixed with subsequent name of the input file.
If I specify same output for each transformation the output file will be overwritten each iteration.
If it is not possible in build.xml(the ant script), any ideas are very much wellcome.

XML in SQL: Element values evaluated differently when using table column rather than string

I'm trying to generate some XML via SQL for load testing, but I'm having trouble constructing the XML correctly. This is what I have:



-- Generate XML from table
SELECT id AS '@id',
action AS '@action',
actionTime AS '@actionTime',
firstName AS '@firstName',
lastName AS '@lastName',
email AS '@email',
(SELECT isActive AS '@isActive',
actionTime AS '@actionTime',
displayName AS '@displayName',
identifierId
FOR XML PATH('identifier'), TYPE
)
FROM scratch.dbo.Identities
FOR XML PATH('user'), ROOT('Users')


This generates XML that looks like this:



<Users>
<user id="QALoadTest1" action="add" actionTime="2015-11-01T00:00:00" firstName="Load" lastName="Test1" email="QALoadTest1@loadtest.com">
<identifier isActive="1" actionTime="2015-11-01T00:00:00" displayName="Load Test 1">
<identifierId>1111111111</identifierId>
</identifier>
</user>
</Users>


If I pass a string as the identifier value, the XML is generated correctly:



SELECT id AS '@id',
action AS '@action',
actionTime AS '@actionTime',
firstName AS '@firstName',
lastName AS '@lastName',
email AS '@email',
(SELECT isActive AS '@isActive',
actionTime AS '@actionTime',
displayName AS '@displayName',
'11111111111'
FOR XML PATH('identifier'), TYPE
)
FROM scratch.dbo.Identities
FOR XML PATH('user'), ROOT('Users')


This generates the following, which is what I want:



<Users>
<user id="QALoadTest1" action="add" actionTime="2015-11-01T00:00:00" firstName="Load" lastName="Test1" email="QALoadTest1@loadtest.com">
<identifier isActive="1" actionTime="2015-11-01T00:00:00" displayName="Load Test 1">11111111111</identifierId>
</user>
</Users>


What's the difference between using a column value and a string here? Interestingly, when I wrap the column value in single quotes (''' + identifierId + ''') it generates the XML in the correct structure, but with the additional quote marks (...displayName="Load Test 1">'11111111111'</identifierId>)

Recover hybrid page Alfresco Share

I've created a new page Aikau, but I changed the XML file and the rendered page content between the standard Share header and footer disappeared.



In this page, I want the arguments of the query string, so I write this code:




page.get.desc.xml:




<webscript>
<shortname>My New Page</shortname>
<url>/hdp/ws/my-new-page</url>
<authentication>user</authentication>
</webscript>



page.get.js:




function main ()
{
// Get the args
var fileProp = args["test"];

model.temp = fileProp;
}

main();



page.get.html.ftl:




Test arg: ${temp}


I have to put /hdp/ws/my-new-page in the XML file to write the content of FTL file in this page... But why did the header and footer of the Alfresco template disappeared ? hdp serves for this purpose. And if I don't put the URL like that on the XML, the page appears with the template.



What is wrong in my code? Or how can I recover the template?

Wallet not updating with balance and database error

I'm fairly new to using bitcoins and have been having some trouble with my wallet. I bought bitcoins on coinbase and transferred them to my bitcoin core wallet. The transaction was confirmed with 616 confirmations, but it has been several days and the balance has not shown up in my wallet. At the time, the wallet was was synchronizing with the network for what must have been a total of 24+ hours and was less than half way there. Last night, before it was done synchronizing, I got a database error and now it's "Reindexing blocks on disk" and is 3 years behind. Are my bitcoins lost or will they be visible in my wallet once my wallet is done reindexing?

url rewrite with blog url included

I need to configure my website with blog for url rewriting. to make it seo friendly i have placed url rewrite, where it count www.amadcrew.com and http://www.amadcrew.com saperate urls. following is the code which made it working perfectly.



# Redirect to www location
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^amadcrew.com [NC]
RewriteRule ^(.*)$ http://www.amadcrew.com/$1 [R=301,NC]


but some how i am unable to run my blog which url is .amadcrew/madcrew_blog. before it was working perfectly and now there is a white page i see.



kindly help me for url rewriting for seo friendly.



thanks