我想知道为什么我们使用九补丁?我知道缩小或拉伸图像,但如果我想调整图像大小,我们不能在像gimp这样的专用图像编辑器上进行调整吗?
我想知道View和ViewParent有什么区别?我想获得一个父母的Id,ImageView
但我不能这样做:
myImageView.getParent().getId();
Run Code Online (Sandbox Code Playgroud)
那么还有另一种获取此ID的方法吗?
我试图使用方法setLayoutParams来指定我的表格布局的图形参数,但我不确定方法setLayoutParams是否采用像素值或倾角值,特别是在java中存储的值似乎是像素值,例如,如果我声明这两个变量:
private int blockDimension = 50;
private int blockPadding = 2;
Run Code Online (Sandbox Code Playgroud)
然后调用方法:
tableRow.setLayoutParams(new LayoutParams( (blockDimension + 2 * blockPadding) * numberOfColumnsInMineField,blockDimension + 2 * blockPadding) );
Run Code Online (Sandbox Code Playgroud)
它们被视为像素还是一旦传递给方法就被转换?那么如果不是,我怎样才能在java中设置dip值?
为什么我们总是要抛出方法返回的值findViewById(id)
?该方法已经返回一个视图,正如我在google参考中看到的那样:
http://developer.android.com/reference/android/view/View.html#findViewById(int)
然后是否可以从视图中分离出另一个东西?例如,执行以下操作:
ImageView image = (ImageView) findViewById(R.id.image) ?
Run Code Online (Sandbox Code Playgroud) 我想在视图底部有一个不同小部件的“工具栏” ...每个小部件都由ImageView
代表图标和TextView
描述的组成。这是XML代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linear_layout_shelves"
android:background="@drawable/final_shelves"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginLeft="70dp"
android:layout_marginRight="65dp"
android:layout_marginTop="@dimen/first_shelf_margin_top"
android:orientation="horizontal" >
<ImageView
android:id="@+id/image_11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:src="@drawable/image1"
android:clickable="true"/>
<ImageView
android:id="@+id/image_12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:src="@drawable/image2"
android:clickable="true" />
<ImageView
android:id="@+id/image_13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:src="@drawable/image3"
android:clickable="true" />
</LinearLayout>
<!-- "Tools" : Cancel, delete, details -->
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
>
<!-- Cancel Widget -->
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/delete_widget"
android:layout_weight="1"
android:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cancel_icon"
android:src="@drawable/cancel_128"
android:clickable="true" …
Run Code Online (Sandbox Code Playgroud) 我有以下正则表达式:
.*(?:(?:(?<!a)cc|string).*number).*
Run Code Online (Sandbox Code Playgroud)
我试图理解?
括号之间的字符串开头是什么意思.我知道了吗?意味着前一个字符'a'可以重复零次或一次.但它出现在字符串的开头是什么意思?
android ×5
android-xml ×1
findviewbyid ×1
gravity ×1
image ×1
layout ×1
nine-patch ×1
parent ×1
pixel ×1
regex ×1
resize ×1