Android 「xmlns:tools」「tools:context」ってなんだろう?

来源:互联网 发布:java解压zip文件 编辑:程序博客网 时间:2024/04/30 02:40

Android 「xmlns:tools」「tools:context」ってなんだろう?【Android TIPS】

    

     http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0309/2567.html



使用[Android] shape自定义按钮
    https://akira-watson.com/android/custom-button.html




ボタンの上下左右に画像を表示する方法

      http://android-note.open-memo.net/sub/button__compound_image.html

你可以用Button 的Andriod属性设定
    drawableTopdrawableLeftdrawableRightdrawableTop

还可以用编程方式设定
<Button        android:id="@+id/button1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="Click!"         android:drawableLeft="@drawable/left_image" />
也可以编程来设定
public class MainActivity extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState)     {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);                Button button = (Button) findViewById(R.id.button);        Drawable leftDrawable = getResources().getDrawable(                R.drawable.left_image);        leftDrawable.setBounds(0, 0, tabImage.getWidth, tabImage.getHeight());            //画像を描くボタン上での位置を指定        button.setCompoundDrawables(leftDrawable, null, null, null);            //左側に画像を表示        button.setCompoundDrawablePadding(3);            //画像とボタンのパディングを指定    }}

0 0