每日会议20230416
进度汇报:
吕金帅:重新对web端功能进行了重新构思
张博文:美化了界面,学习了如何改变安卓复选框的大小
我想提出的CheckBox有点小/大了,我该怎么办呢?
可以通过scaleX = "" 和scaleY=""属性来设置
-
<CheckBox
-
android:scaleX="0.6"
-
android:scaleY="0.6"
-
android:id="@+id/iv_checkbox"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:button="@drawable/checkbox"
-
android:onClick="onClick" />
1. 你只需要设置相关的可绘制对象,并设置它们的复选框:
-
<CheckBox
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:text="new checkbox"
-
android:background="@drawable/my_checkbox_background"
-
android:button="@drawable/my_checkbox" />
诀窍是如何设置的可绘制对象。下面是关于这个一个很好的教程。
2. 与API级别11开始有另一种方法存在:
-
<CheckBox
-
...
-
android:scaleX="0.70" // 我的直接加了这两就好了
-
android:scaleY="0.70"
-
/>
3. 更新:这只能从API的17起工程... 要添加到另一个辉煌的答案已经给出,只能使复选框,小到文字大小允许。 按我对这个问题的回答: -我们如何能减少核取方块的大小,请一个想法CheckBox
从文本以及图像源于它的高度。 在你的XML设置这些属性:
-
android:text=""
-
android:textSize="0sp"
当然,如果你想没有文本(工作这仅适用 没有这些改变,CheckBox
大约是我的形象幅度较大 CodeGo.net,由乔
4. 本教程介绍了如何做到这一点链接土特
5. 我找到了一个办法做到这一点,而无需创建自己的图像。换句话说,该系统的图像被缩放。我不会假装,该解决方案是完美的,如果有人知道的方式来缩短的步骤,我会很高兴地找出如何。 首先,我把下列项目(WonActivity)的主要活动类。这是直接从堆栈溢出-谢谢你们!
-
/** get the default drawable for the check box */
-
Drawable getDefaultCheckBoxDrawable()
-
{
-
int resID = 0;
-
if (Build.VERSION.SDK_INT <= 10)
-
{
-
// pre-Honeycomb has a different way of setting the CheckBox button drawable
-
resID = Resources.getSystem().getIdentifier("btn_check", "drawable", "android");
-
}
-
else
-
{
-
// starting with Honeycomb, retrieve the theme-based indicator as CheckBox button drawable
-
TypedValue value = new TypedValue();
-
getApplicationContext().getTheme().resolveAttribute(android.R.attr.listChoiceIndicatorMultiple, value, true);
-
resID = value.resourceId;
-
}
-
return getResources().getDrawable(resID);
-
}
第二,我创建了一个类“缩放绘制”。请注意,它从标准ScaleDrawable不同。
-
import android.graphics.drawable.*;
-
/** The drawable that scales the contained drawable */
-
public class ScalingDrawable extends LayerDrawable
-
{
-
/** X scale */
-
float scaleX;
-
/** Y scale */
-
float scaleY;
-
ScalingDrawable(Drawable d, float scaleX, float scaleY)
-
{
-
super(new Drawable[] { d });
-
setScale(scaleX, scaleY);
-
}
-
ScalingDrawable(Drawable d, float scale)
-
{
-
this(d, scale, scale);
-
}
-
/** set the scales */
-
void setScale(float scaleX, float scaleY)
-
{
-
this.scaleX = scaleX;
-
this.scaleY = scaleY;
-
}
-
/** set the scale -- proportional scaling */
-
void setScale(float scale)
-
{
-
setScale(scale, scale);
-
}
-
// The following is what I wrote this for!
-
-
public int getIntrinsicWidth()
-
{
-
return (int)(super.getIntrinsicWidth() * scaleX);
-
}
-
-
public int getIntrinsicHeight()
-
{
-
return (int)(super.getIntrinsicHeight() * scaleY);
-
}
-
}
最后,我定义了一个复选框类。
-
import android.graphics.*;
-
import android.graphics.drawable.Drawable;
-
import android.widget.*;
-
/** A check box that resizes itself */
-
public class WonCheckBox extends CheckBox
-
{
-
/** the check image */
-
private ScalingDrawable checkImg;
-
/** original height of the check-box image */
-
private int origHeight;
-
/** original padding-left */
-
private int origPadLeft;
-
/** height set by the user directly */
-
private float height;
-
WonCheckBox()
-
{
-
super(WonActivity.W.getApplicationContext());
-
setBackgroundColor(Color.TRANSPARENT);
-
// get the original drawable and get its height
-
Drawable origImg = WonActivity.W.getDefaultCheckBoxDrawable();
-
origHeight = height = origImg.getIntrinsicHeight();
-
origPadLeft = getPaddingLeft();
-
// I tried origImg.mutate(), but that fails on Android 2.1 (NullPointerException)
-
checkImg = new ScalingDrawable(origImg, 1);
-
setButtonDrawable(checkImg);
-
}
-
/** set checkbox height in pixels directly */
-
public void setHeight(int height)
-
{
-
this.height = height;
-
float scale = (float)height / origHeight;
-
checkImg.setScale(scale);
-
// Make sure the text is not overlapping with the image.
-
// This is unnecessary on Android 4.2.2, but very important on previous versions.
-
setPadding((int)(scale * origPadLeft), 0, 0, 0);
-
// call the checkbox's internal setHeight()
-
// (may be unnecessary in your case)
-
super.setHeight(height);
-
}
-
}
赵纪旭:主要学的web的界面以及Vue的组件学习。
具体目标:
完成界面的美化,试着调用一些ui
会议图片:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端