在尝试理解(相当新的)Android设计网站的Metrics and Grids页面之后,我放弃了很多东西.所以,基本上,我正在尝试找到Android 4中使用的原始布局,以便我可以应用相同的概念.
为了使这个问题更加客观和下计算器的"过宽"斧头不会失败,我问你用来重新布局,准确和完整,该网页上的例子.Google是否在样本中提供了这些内容?也许是一个着名的教学存储库,努力符合标准?
仅作为示例,不清楚如何重新创建"48/3指标"(16/16/16)以使文本适合它.如果我想使用1行小文本怎么办?它是16/wrap_content/16还是16/16/16才能使它与集合周围的其他布局保持一致?如果...
我相信这不仅有助于小型开发者,而且最重要的是,有助于标准化Android Play中应用的外观和感觉.该网站是一个良好的开端,但远非理想.
添加细节
我从来没有问过这么多的投票问题,我甚至没想到(我还有其他问题,我认为"更好",但到目前为止还没有那么多的投票和赞成).当然,并不是说我关心投票,而是表明对我所要求的东西有很大的需求(这里有一点广告,但仍然......).
对评论的回复
@ Ricardo Amaral:
如果我不够清楚,我真的很抱歉:
@ Michael Slade:
我知道他们是一些例子,他们可能已经从模板中进行了线框化.如上所述,我已经重用了SDK中的代码,我知道它们只是示例,我们可以偏离它们.再说,经过这么久,没有人回答.
选择性受益于精确度.这就是我想说的问题.因为这是一个建议并不意味着它的指导方针可以是你想要的任何东西.如果你这样做,那就不再是推荐了.顺便提一下,这就是建议的全部要点:在不强迫任何人的情况下提供实施理论.
感谢大家!
我正在寻找以下指导或明确的答案.我想使用谷歌Android USB驱动程序并修改android_winusb.inf以支持任意数量的Android设备.我能够成功添加HTC Evo平板电脑,但是当我尝试添加LG(Optimus)或三星(Indulge,Admire)时,驱动程序似乎安装得很好,但ADB没有看到它.
你能让Google Android Driver适用于任何Android手机吗?如果是这样......怎么样?
我已经尝试了很多排列%SingleAdbInterface%并%CompositeAdbInterface%与供应商和产品ID的变化.
我有一个枚举,我需要将值显示为本地化字符串.我目前的做法是:
public enum MyEnum {
VALUE1(R.string.VALUE1),
VALUE2(R.string.VALUE2),
.
.
VALUE10(R.string.VALUE10);
private int mResId = -1;
private MuEnum(int resId) {
mResId = resId;
}
public String toLocalizedString(Resources r) {
if (-1 != mResId) return (r.getString(mResId));
return (this.toString());
}
}
Run Code Online (Sandbox Code Playgroud)
有没有更简单的方法来做到这一点?如果我能以某种方式根据枚举值名称(即'VALUE1')查找资源,我会喜欢它.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="VALUE1"/>My string</string>
<string name="VALUE2"/>My string 2</string>
.
.
<string name="VALUE10"/>My string 3</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
编辑:为了将来参考,这是最适合我的解决方案:
public enum MyEnum {
VALUE1,
VALUE2,
.
.
VALUE10;
/**
* Returns a localized label used to represent this enumeration value. …Run Code Online (Sandbox Code Playgroud) 我有一个包含两个ImageView的布局.我希望其中一个在纵向中可见,另一个在横向中可见.如何使用资源实现它?(我知道如何以编程方式设置它,但我需要使用资源来实现它的特定用途).
我试过类似的东西
在res/layout/may_layout.xml中:
...
<ImageView
android:id="@+id/image1"
android:visibility="@integer/visible_in_portrait" <<-- is this allowed?
...
/>
<ImageView
android:id="@+id/image2"
android:visibility="@integer/visible_in_landscape"
...
/>
Run Code Online (Sandbox Code Playgroud)
在res/values/integers.xml中:
...
<!-- NOTE: 0 and 8 are VISIBLE and GONE respectively -->
<integer name="visibile_in_portrait">0</integer>
<integer name="visibile_in_landscape">8</integer>
Run Code Online (Sandbox Code Playgroud)
在res/values-land/integers.xml中:
...
<integer name="visibile_in_portrait">8</integer>
<integer name="visibile_in_landscape">0</integer>
Run Code Online (Sandbox Code Playgroud)
但是当我试图给图像充气时,我得到一个运行时错误(索引超出范围).当我删除android:visibility语句时,程序运行但我看到两个图像.
问:将资源用作android:visibility属性的值的方法是什么?
(如果你想知道为什么以编程方式设置它将无法帮助我,它与使用文件uri位图的app小部件的自动landspace/portrait切换有关).
我想知道如何在Android中的SQLite表中插入一个空值.
这是表:
"create table my table (_id integer primary key autoincrement, " +
"deviceAddress text not null unique, " +
"lookUpKey text , " +
"deviceName text , " +
"contactName text , " +
"playerName text , " +
"playerPhoto blob " +
");";
Run Code Online (Sandbox Code Playgroud)
我想使用一个简单的插入命令,execSQL但因为其中一个值是blob我不能这样做(我认为).
所以,我正在使用标准db.Insert命令.如何使其中一个值为null?
如果我只是在ContentValues对象中跳过它会自动在列中放置一个空值吗?
我正在开发一个Android应用程序,我打算发布它(付费应用程序).我听说盗版Android应用程序非常容易(比iphone容易得多).我想知道你的经验或你知道什么,如何提高我的应用程序的安全性?我知道我永远无法100%获得安全保障,但我想让人们更难以盗版或非法分发任何想法,经验,评论你可以分享吗?
我最近参加了ABS4.0潜水.但是,我似乎在使用MenuInflater时出现问题.
当使用getMenuInflater()方法时,我收到一条错误消息,指出:"类型不匹配:无法从android.view.MenuInflater转换为com.actionbarsherlock.view.MenuInflater"
因此,看起来定义正在获取菜单inflater的ABS版本,但getMenuInflater()方法返回基本Android版本.代码如下:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这里做错了什么?非常感谢!
我想将视频录制从我的Android手机流式传输到网络媒体服务器.
第一个问题是,当将MediaRecorder输出设置为套接字时,流会丢失一些mdat大小的标头.这可以通过在本地预处理该流并将丢失的数据添加到流中以便生成有效的输出流来解决.
问题是如何从那里开始.
如何将该流作为RTMP流输出?
我想要实现的是:在活动开始后,我希望没有选择/检查RadioButton.
我的问题是:当活动开始时,总是选择/检查第一个RadioButton.
我radioButton1.setChecked(false)在初始化radiobutton之后尝试(在onCreate里面),但是当活动开始时,我无法手动检查/选择第一个radiobutton.直到我选择第二或第三个单选按钮,我现在可以选择/检查第一个单选按钮.
有人能告诉我将图像转换为字节数组并将该字节数组转换为base64字符串的代码.我写下面的代码没有得到正确的结果.
String filepath = "/sdcard/Image/ic_launcher.jpg";
File imagefile = new File(filepath);
FileInputStream fis = null;
try {
fis = new FileInputStream(imagefile);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap bm = BitmapFactory.decodeStream(fis);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100 , baos);
byte[] b = baos.toByteArray();
String encodedImage = Base64.encodeToString(b, Base64.DEFAULT);
Run Code Online (Sandbox Code Playgroud)
我得到的结果是
[-1, -40, -1, -32, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 72, 0, 72, 0, 0, -1, -20, 4, -7, 68, …Run Code Online (Sandbox Code Playgroud)