<style name=""> <item name="android:shadowColor">#7f000000</item> <item name="android:shadowDx">0</item> <item name="android:shadowDy">0</item> <item name="android:shadowRadius">5</item> </style>
月份:2018年10月
Anroid 小记(dp->dx,measure(),PagerAdapter)
android:typeface="monospace"
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6, getResources().getDisplayMetrics());
View childView = createChildView(inflater, resources, BoothCenterItemData.defaultData[0]); int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); childView.measure(widthMeasureSpec, heightMeasureSpec); int measuredHeight = childView.getMeasuredHeight();
public class BoothCenterAdapter extends PagerAdapter { private final List<BoothCenterItemView> itemViews; public BoothCenterAdapter(List<BoothCenterItemView> itemViews) { this.itemViews = itemViews; } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { View view = itemViews.get(position); container.addView(view); return view; } @Override public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { container.removeView((View) object); } @Override public int getCount() { return itemViews.size(); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view == object; } }
Android签名
1、创建
keytool -genkey -keystore [签名文件] -alias bieming -keyalg RSA -validity 10000
2、查看
keytool -list -keystore [签名文件]
注:当密码中有特殊符号时:keytool -list -v -keystore android.keystore -storepass ‘112&He’
3、修改别名
keytool -changealias -keystore android.keystore -alias [当前别名] -destalias [新别名]
ScrollView 设置内部充满全屏
android:fillViewport=“true” 解决
<ScrollView
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:fillViewport=”true”
android:scrollbars=”none” >
EditText光标问题
1、在Edittext中加入以下属性
android:cursorVisible=”true”
android:textCursorDrawable=”@null”
2、在Edittext中加入以下属性
android:cursorVisible=”true”
android:textCursorDrawable=”@drawable/test_cursor”
对应的drawable文件
3、如果以上没有效果就请用这个
明确指定EditText的inputType属性值inputType属性中的textCapSentences
不要用这个,国内手机好像没有用到这个,个人证实而已,用text或者textMultiLine
android:inputType=”text|textMultiLine”
The Farmer and the Nightingale(夜莺)
A farmer lay listening to a nightingale(夜莺)’s song throughout(在整个期间) one summer night.
He was so pleased with it that the next night he set a trap(陷阱) for it and caught it.
“Now I have caught you,” he cried, “and you will always sing to me.”
“We nightingales(夜莺) never sing in a cage(笼子),” said the bird.
“Then I’ll eat you,” said the farmer.
“I have always heard that a nightingale(夜莺) on toast(吐司) is delicious.”
“No, don’t kill me,” said the nightingale(夜莺); “but set me free, and I’ll tell you three things worth much more than my poor body.”
The farmer let him loose, and he flew up to a branch(树枝) of a tree and said, “Never believe a prisoner(囚犯)’s promise; that’s one thing. Then again: keep what you have. And third piece of advice is: do not waste your sadness on what is lost forever(永远).”
Then the song-bird flew away.
MORAL: If you love someone, set them free.
The Farmer and the Goats(山羊)
It was a stormy day, and the snow was falling fast.
A farmer led his goats(山羊), all white with snow, into a cave(洞穴) for shelter(避难).
There, he found a group of wild goats(山羊), more in number and larger than his own.
At the end of the day he drove both the wild goats(山羊) and his own goats(山羊) home and put them all into the pen(羊圈) together.
Next day the weather was so bad that he could not take them out as usual: so he kept them at home in the farmyard(农场), and fed(喂养) them there.
He only gave his own goats(山羊) enough food to keep them from(避免) starving(挨饿), but he gave the wild goats(山羊) as much as they could eat and more; for he was very anxious(渴望的) for them to stay, and he thought that if he fed(喂养) them well they wouldn’t want to leave him.
When the weather got better, he took them all out to fields again; but when they got near the hills, the wild goats(山羊) ran off.
The farmer was very angry at this, and said, “How can you run away like that after the way I’ve treated you!”
Hearing this, one of them turned round and said, “Oh, yes, you treated us all right–too well, in fact; it was just that fact that got us thinking. If you treat newcomers like ourselves so much better than your own goats(山羊), it’s more than likely that, if another lot of strange goats(山羊) joined yours, you would probably give them our food and we would go hungry.”
MORAL: They who ignore(忽视) their old friends for new ones deserve(应受) to lose both.
The Farmer and the Fox(狐狸)
A farmer was greatly annoyed(被激怒) by a fox(狐狸), which came into his yard at night and carried off his chickens.
So he set a trap(陷阱) for him and caught him; and in order to get revenge(报复) upon the fox(狐狸), the farmer tied a bunch of(一扎) cloth(布料) to his tail, set fire to(点燃) it and let him go.
As ill-luck would have it, however, the fox(狐狸) made straight for(一直向..走去) the fields where the corn was standing ripe(成熟的) and ready for cutting.
The corn quickly caught fire(着火) and was all burnt up(烧光), and the farmer lost all his harvest(收成).
MORAL: Revenge(报复) is a two-edged sword(剑).
The Farmer and the Donkey(驴)
An old farmer was sitting in a field watching his donkey(驴), when all of a sudden he caught sight of(看见) some soldiers(士兵) moving towards them.
He jumped up in a moment, and asked the donkey(驴) to escape(逃跑) with him as fast as he could, “Or else,” said he, “we shall both be captured(被俘虏) by the enemy.”
But the donkey(驴) just looked round lazily and said, “And if so, do you think they’ll make me carry heavier loads(负载物) than I have to now?”
“No,” said his master(主人). “Oh, well, then,” said the donkey(驴), “I don’t mind if they do take me, for I shan’t be any worse off.”
MORAL: The poor may not fear a change of masters(主人) in the way that the rich do.
The Farmer and the Dogs
During a cold winter, a farmer was trapped(被困) in his house by the snow.
As he could not get any food from outside, he began eating his won sheep.
As the cold weather continued, he began to eat his goats(山羊).
And finally–for there was no change in the cold weather–he ate the oxen(阉牛) who worked on the farm.
Then the dogs said to one another, “We should leave at once, If the master(主人) eats even the oxen(阉牛), who do all the work around here, do you think he won’t eat us?”
MORAL: Learn from the misfortunes(不幸) of others, not just from your own.
The Farmer and His Sons
A farmer, being at death’s door, and wanting to tell his sons an important secret, called them round him and said, “My sons, I am shortly about to die; I would have you know, therefore, that in my farm there lies a hidden treasure. Dig, and you will find it.”
As soon as their father was dead, the sons took their farming tools and dug up(挖掘) the soil of the farm over and over again, in their search for the treasure which they believed was there.
They found no treasure, but the farm, after so much digging, produced a magnificent(极好的) crop(收成).
MORAL: Hard work is the key to prosperity(富足).
The Eagle(鹰) and the Crow(乌鸦)
An eagle(鹰), flying down from a high rock, grabbed(抓住) a lamb(羔羊) and carried him up into the sky in his claws(爪子).
A crow(乌鸦), who saw this, was envious(嫉妒的) of the strength and flight(飞翔) of the eagle(鹰).
He flew around and landed on a large sheep, hoping to carry him off as the eagle(鹰) had done.
However, his claws(爪子) became stuck in the sheep’s wool(羊毛) and he couldn’t let go, although he flapped(扑动) his wings as much as he could.
A farmer, seeing what had happened, ran up and caught him.
He cut the crow(乌鸦)’s wings and took him home for his children.
When they said, “Father, what kind of bird is it?” he replied, “We all know he is a crow(乌鸦), but he would like you to think of him as an eagle(鹰).”
MORAL: Sometimes ambition(野心) can lead us beyond the limits(极限) of our power.
An Envious(嫉妒的) Man
A poor man was always complaining(抱怨) that he did not have enough good things, and his neighbor had more, even though his neighbor did not deserve(应得) them.
One day he prayed(祈祷) to God to make him rich.
God answered his prayer(祷告) and spoke to him, saying, “Ask for as much as you want, and I will give it to you –but remember, I will also give your neighbor twice as much.”
To test what God had said, the poor man asked for a large sum(一笔款项) of money, which he received–but he also saw that his neighbor received twice as much.
He became so angry that he asked God to make him blind in one eye, so that he could have the pleasure of seeing his neighbor become totally blind.
MORAL: If you want to be happy, don’t compare yourself with others.
The Dove(鸽子) and the Crow(乌鸦)
A dove(鸽子) was locked in a cage(笼子) and told everyone about how many children she had.
A crow(乌鸦) heard this and said, “The larger your family, the more sadness you have, since you are in this cage(笼子) and they are not.”
MORAL: To enjoy what we have, we must have freedom.
The Dove(鸽子) and the Ant
An ant went to the bank of a river to drink, and fell into the water.
Being carried away by the fast water, he was close to dying.
A dove(鸽子), sitting on a tree above the water, dropped a leaf into the river close to him.
The ant, climbing on to it, got to the bank safely.
Shortly afterwards, a bird catcher came close and stood under the tree, and started making a trap(陷阱) for the dove(鸽子).
The ant, seeing this, stung(叮) him in the foot.
He suddenly threw down the trap(陷阱), and the dove(鸽子) flew away.
MORAL: Thankful people will always find a way to show their thanks.
The Donkey(驴), the Rooster(公鸡), and the Lion
A donkey(驴) and a rooster(公鸡) were together, when a hungry lion came towards them.
He was about to attack the donkey(驴), when the rooster(公鸡) (whose voice, it is said, scares(使害怕) lions) crowed(啼叫) loudly, and the lion fled away(逃跑).
The donkey(率), seeing this, got some courage to attack the lion, and ran after him.
He hadn’t run far when the lion turned around, grabbed(抓住) him and ate him.
MORAL: False(错误的) confidence(信心) often leads to danger.
The Donkey(驴), the Fox(狐狸), and the Lion
A donkey(驴) and a fox(狐狸) went out into the forest together.
They had not gone far when they met a lion.
The fox(狐狸) said to the lion that he would help the lion catch the donkey(驴) if the lion did’t eat him.
After the lion had agreed, the fox(狐狸) tricked(欺骗) the donkey(驴) so that it fell into a deep hole.
When the lion saw this, he ate the fox(狐狸) at once, and left the donkey(驴) to be eaten later.
MORAL: Cheaters(骗子) must expect to be cheated(被欺骗).
mac上访问samba服务器
原文章地址:https://blog.csdn.net/h106140873/article/details/76680545
打开safari输入smb://ip,回车后出现输入用户名密码对话框,若是匿名则选择作为“客人”选项
或
打开Finder(或在桌面),CMD + k,可以得到以下页面:
在smb://后面,输入你的服务器地址或域名
Android 字符串测绘参考值
private void drawText(Canvas canvas, int x, int y, int width, int height){
Paint.FontMetrics fontMetrics = paintText.getFontMetrics();
canvas.drawText("TESThf我y", x, y, paintText);
int line1 = y;
int line2 = (int) (line1 + fontMetrics.top);
int line3 = (int) (line1 + fontMetrics.ascent);
int line4 = (int) (line1 + fontMetrics.descent);
int line5 = (int) (line1 + fontMetrics.leading);
int line6 = (int) (line1 + fontMetrics.bottom);
// line2 top = y + top
canvas.drawLine(0, line2, width, line2, linePaint);
canvas.drawLine(20, line2, 20 + 100, line2 - 100, linePaint);
canvas.drawText("top:" + fontMetrics.top, 100 + 20, line2 - 100, linePaint);
// line3 ascent = y + ascent 上升
canvas.drawLine(0, line3, width, line3, linePaint);
canvas.drawLine(40, line3, 40 + 100, line3 - 100, linePaint);
canvas.drawText("ascent:" + fontMetrics.ascent, 100 + 40, line3 - 100, linePaint);
// line1 base = y
canvas.drawLine(0, line1, width, line1, linePaint);
canvas.drawLine(60, line1, 60 + 100, line1 + 100, linePaint);
canvas.drawText("Base", 60 + 100, line1 + 100, linePaint);
// line4 descent = y + descent 下降
canvas.drawLine(0, line4, width, line4, linePaint);
canvas.drawLine(0, line4, 100, line4 + 100, linePaint);
canvas.drawText("descent:" + fontMetrics.descent, 100, line4 + 100, linePaint);
// line5 leading = y + leading 行距
canvas.drawLine(0, line5, width, line5, linePaint);
canvas.drawLine(200, line5, 200 + 100, line5 + 100, linePaint);
canvas.drawText("leading:" + fontMetrics.leading, 200 + 100, line5 + 100, linePaint);
// line6 bottom = y + bottom
canvas.drawLine(0, line6, width, line6, linePaint);
canvas.drawLine(400, line6, 400 + 100, line6 + 100, linePaint);
canvas.drawText("bottom:" + fontMetrics.bottom, 400 + 100, line6 + 100, linePaint);
}
The Donkey(驴) in the Lion’s Skin
A donkey(驴) put on a lion’s skin to scare(吓唬) all the animals he met in the forest.
Then he went about frightening(吓唬) every one he met, for they all thought he was a lion, and ran away when they saw him coming.
Happy with the success of his trick(诡计), he loudly brayed(嘶叫) in triumph(得意洋洋地).
At last, meeting a fox(狐狸), he tried to frighten(吓唬) him too.
But when the fox(狐狸) heard the sound of his voice, he said, “I might have been frightened(害怕的) too, if I had not heard your voice.”
MORAL: Don’t take your pretending(伪装) too far, or you’ll be found out.